Otherwise, the exception information might be traced twice. So when you throw out exception in the catch clause, the exception should not be traced.
try{ …… }catch (Exception e){ if (log.doError()) log.error(“exception in XXXX method”, e); // Not permitted for it may cause same exception be traced duplicated. throw new BTTSampleException1(e); }
try{ …… }catch (Exception e){ throw new BTTSampleException1(e) ; // or use: throw new BTTSampleException1(“more exception information here…”, e); // The below usage is NOT permitted for the exception stack trace information will be lost. // throw new BTTSampleException1(e.getMessage()) ; }