Tutorials     About     RSS
Tech and Media Labs

Throwing Exceptions

Jakob Jenkov
Last update: 2014-05-26

Throwing exception is the next step after error detection and information gathering. When you detect an error, you need to determine if you need to throw an exception, and what information to include in that exception.

What information to embed in the exception is determined in the previous stage - Error Information Gathering

Here is a simple example:

String errorId = ...
String errorDescription = ...
String contextId = ....

throw new MyException(errorId, errorDescription, contextId);

Later in this tutorial trail I will show you an Exception class definition that is much better suited to address the requirements listed earlier in this trail.

Jakob Jenkov

Featured Videos

Thread Congestion in Java - Video Tutorial

Sponsored Ads

Maildroppa - Smart Email Marketing Solution
Close TOC

All Trails

Trail TOC

Page TOC