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

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -