java - How to use chained exceptions -
in application have never used chained exception. looking forward use believe can make code better. being new can provide me example in type of scenario , how can used?
the following example shows how use chained exception.
try { } catch (ioexception e) { throw new sampleexception("other ioexception", e); }
in example, when ioexception
caught, new sampleexception
exception created original cause
attached , chain of exceptions
thrown next higher level exception
handler.
Comments
Post a Comment