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 ...

Get Java Garage now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.