001 package org.rakeshv;
002
003 /**
004 * A custom exception that is used to wrap all types of errors or
005 * exceptions that may be encountered by applications. This may be
006 * used to unify final exception handling.
007 *
008 * @author Rakesh Vidyadharan 9<sup><small>th</small></sup> October, 2004
009 *
010 * <p>Copyright 2004, Rakesh Vidyadharan</p>
011 *
012 * $Id: CustomException.java,v 1.2 2005/08/04 10:49:12 rakesh Exp $
013 */
014 public class CustomException extends Exception
015 {
016 /**
017 * Constructs a new exception with null as its detail message. The
018 * cause is not initialized, and may subsequently be initialized by
019 * a call to Throwable.initCause(java.lang.Throwable). Just uses
020 * the super-class constructor.
021 */
022 public CustomException()
023 {
024 super();
025 }
026
027 /**
028 * Constructs a new exception with the specified detail message. The
029 * cause is not initialized, and may subsequently be initialized by
030 * a call to Throwable.initCause(java.lang.Throwable). Just calls
031 * the corresponding super-class constructor.
032 *
033 * @param message - The detail message. The detail message is
034 * saved for later retrieval by the Throwable.getMessage() method.
035 */
036 public CustomException( String message )
037 {
038 super( message );
039 }
040
041 /**
042 * Constructs a new exception with the specified detail message and
043 * cause. Just uses the appropriate super-class constructor.
044 *
045 * <p>Note that the detail message associated with cause is not
046 * automatically incorporated in this exception's detail message.</p>
047 *
048 * @param message - The detail message. The detail message is
049 * saved for later retrieval by the Throwable.getMessage() method.
050 * @param cause - The cause (which is saved for later
051 * retrieval by the Throwable.getCause() method). (A null value is
052 * permitted, and indicates that the cause is nonexistent or
053 * unknown.)
054 */
055 public CustomException( String message, Throwable cause )
056 {
057 super( message, cause );
058 }
059
060 /**
061 * Constructs a new exception with the specified cause. The detail
062 * message is set as <code>( cause==null ? null : cause.toString() )
063 * </code> (which typically contains the class and detail message of
064 * cause). This constructor is useful for exceptions that are little
065 * more than wrappers for other throwables (for example,
066 * PrivilegedActionException). Just uses the appropriate super-class
067 * constructor.
068 *
069 * @param cause - The cause (which is saved for later
070 * retrieval by the Throwable.getCause() method). (A null value is
071 * permitted, and indicates that the cause is nonexistent or
072 * unknown.)
073 */
074 public CustomException( Throwable cause )
075 {
076 super( cause );
077 }
078 }