O'Reilly logo

Java Garage by Eben Hewitt

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Toolkit: A Custom Exception

ApplicationException.java

package net.javagarage.demo.exceptions;
/**<p> * This class is a subclass of java.lang.Exception, * and can be reused to represent any application- * specific exceptional state. For instance, if you * are using a database, it is not a good idea to * allow database exceptions to bubble up to the * user, or to require handling by more than one * layer in your application. * <p> * For these reasons, you typically want to make your * own exception wrapper that will serve to represent * application-level exceptional states. For example, * an online store might have a CartException that * gets thrown explicitly if the user tries to check * out with no items in their cart, or tries to * specify ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required