001    package org.rakeshv.mail;
002    
003    /**
004     * A custom exception that is used when any kind of exceptions are
005     * encountered when interacting with the javax.mail package, or the
006     * various other java packages that are used by the system.
007     *
008     * <p>Copyright 2003 Rakesh Vidyadharan</p>
009     *
010     * @author Rakesh Vidyadharan 2003 February 12
011     * @version $Id: MailException.java,v 1.6 2004/05/26 11:42:37 rakesh Exp $
012     */
013    public class MailException extends Exception
014    {
015      /**
016       * A boolean field that indicates the criticality of the error.  A
017       * value of <code>true</code> is used to indicate a critical error,
018       * while a value of <code>false</code> is used to indicate a non
019       * critical error.
020       */
021      private boolean critical = true;
022    
023      /**
024       * Create a new exception with the specified message.  Simply
025       * invokes the super class constructor with the message specified.
026       *
027       * @param message - The message that describes the problem.
028       */
029      public MailException( String message )
030      {
031        super( message );
032      }
033    
034      /**
035       * Create a new exception with the specified message.  Simply
036       * invokes the super class constructor with the message specified.
037       *
038       * @param message - The message that describes the problem.
039       */
040      public MailException( String message, Throwable throwable )
041      {
042        super( message, throwable );
043      }
044    
045      /**
046       * Create a new exception with the specified message.
047       *
048       * @param critical - Use a value <code>true</code> to 
049       *   indicate that the error encountered was critical.
050       * @param message - The message that describes the problem.
051       */
052      public MailException( boolean critical, String message )
053      {
054        super( message );
055        this.critical = critical;
056      }
057    
058      /**
059       * Create a new exception with the specified message and instance of
060       * <code>Throwable</code> that caused the problem.
061       *
062       * @param critical - Use a value <code>true</code> to 
063       *   indicate that the error encountered was critical.
064       * @param message - The message that describes the problem.
065       * @param throwable - The instance of Throwable that caused 
066       *   this instance of the exception to be thrown.
067       */
068      public MailException( boolean critical, String message, 
069          Throwable throwable )
070      {
071        super( message, throwable );
072        this.critical = critical;
073      }
074      
075      /**
076       * Returns {@link #critical}.
077       *
078       * @return boolean - The value/reference of/to critical.
079       */
080      public final boolean getCritical()
081      {
082        return critical;
083      }
084    }