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?

from docs directly

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

Popular posts from this blog

java - Last square of 8x8 grid not drawn, using two nested FOR loops -

What design pattern is this code in Javascript? -

javascript - Unusual behaviour when drawing lots of images onto a large canvas -