Hi, I throw an application exception as below in my catch blocks. Does this catch block will miss the stacktrace exception when finally caught in the caller method? Could anyone please let me know?Thanks in advance,
[ Edited to include code tags - Paul Sturrock ] [ November 01, 2006: Message edited by: Paul Sturrock ]
You are throwing a new exception in the catch block. The caller that catches the ValidationFailedException will ofcourse only be able to see the stacktrace of the ValidationFailedException, and not the stacktrace of the original DataValidationException.
You could have found out this for yourself by writing a small test program.
You can add the original exception to your new exception, either by adding a constructor that accepts a Throwable as an argument and calls the appropriate super class constructor or by calling the initCause() method. Then the code that catches your exception can retrieve the original exception using the getCause() method.