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

Java Generics

Java ForkJoinPool

P2P Networks Introduction



















Close TOC
All Tutorial Trails
All Trails
Table of contents (TOC) for this tutorial trail
Trail TOC
Table of contents (TOC) for this tutorial
Page TOC
Previous tutorial in this tutorial trail
Previous
Next tutorial in this tutorial trail
Next