java - Catch and logging for irrelevant operations -


i've method save timing information of each operation:

    public void queuetimerinfo(long start, long end, string msg) {         try {             timer.queue(start, end, msg);         } catch (interruptedexception e) {             logger.info(e.getmessage());         }     } 

i call above method after each operation. matters operation itself, whereas timing secondary task. that's why decided not when method fails, except logging it.

but told logging without managing exception bad practice. how should rewrite above code?

if know consequences, i.e. timer.queue() call might interrupted , not queue data, , can live that, ok ignore exception. rules, need know when break them.

however, document decision comment in catch block, whoever maintains code later knows not handling exception not oversight, deliberate decision.


Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -