This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
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


Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "exception chaining" Watch "exception chaining" New topic
Author

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
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

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

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

Joined: Oct 13, 2005
Posts: 44590
    
  34
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
Sheriff

Joined: Jul 29, 2008
Posts: 3713
    
  89

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.

Lucky


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