In Java SE it is possible set the cause of an exception using initCause to avoid losing information about the error when catching and rethrowing an exception. Is it possible to do the same in Java ME?
In Java SE it is possible set the cause of an exception using initCause
Share
It is easy to extend the Exception class to achieve this:
This exception is useful for hiding the underlying exceptions, such as when we want to avoid dependancies or when we want to avoid forcing the caller to deal with too many types of exceptions. I generally also create a version of this class extending
RuntimeExceptionfor wrapping exception that I want to be unchecked