jQuery in Action, 3rd edition
The moose likes Beginning Java and the fly likes exception chaining Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "exception chaining" Watch "exception chaining" New topic

exception chaining

jose chiramal
Ranch Hand

Joined: Feb 12, 2010
Posts: 266
Can someone tell me why do we use exception chaining, any practical example for the same ?
David Newton

Joined: Sep 29, 2008
Posts: 12617

To keep the original exception. throw new Exception(oldException)

Did you try searching for "exception chaining"?
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46367
See if you can find a copy of Thinking in Java by Bruce Eckel; as far as I can remember he gives good examples. His opinion about Exceptions in the 3rd edition is completely different from the 4th edition, however
Devaka Cooray
ExamLab Creator

Joined: Jul 29, 2008
Posts: 3927

Please SearchFirst.
The first two Google search results for "Exception Chaining" would give you a better explanation with some practical examples.

Author of ExamLab ExamLab - a free SCJP / OCPJP exam simulator
What would SCJP exam questions look like? -- Home -- Twitter -- How to Ask a Question
Lalit Mehra
Ranch Hand

Joined: Jun 08, 2010
Posts: 384

it is about how an exception is related to another ...

let us say ... you get an exception say SQLException which happened due to some sql related confusion but in actual it is a I/O Exception ...

so the two exceptions are chained together ...

take a look at the complete reference ... although it is not enough but might help you understand some.


I agree. Here's the link: http://aspose.com/file-tools
subject: exception chaining
It's not a secret anymore!