110 lines
2.9 KiB
Java
110 lines
2.9 KiB
Java
/*
|
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
|
* (the "License"); you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at <http://www.mozilla.org/MPL/>.
|
|
*
|
|
* Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
|
|
* WARRANTY OF ANY KIND, either express or implied. See the License for the specific
|
|
* language governing rights and limitations under the License.
|
|
*
|
|
* The Original Code is the Venice Web Communities System - Generic Mail Gateway.
|
|
*
|
|
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
|
|
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
|
* Copyright (C) 2002 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
|
*
|
|
* Contributor(s):
|
|
*/
|
|
package com.silverwrist.mailgate;
|
|
|
|
import java.io.PrintStream;
|
|
import java.io.PrintWriter;
|
|
|
|
public class BaseException extends Exception
|
|
{
|
|
/*--------------------------------------------------------------------------------
|
|
* Attributes
|
|
*--------------------------------------------------------------------------------
|
|
*/
|
|
|
|
private Throwable inner = null; // internal "root cause" exception
|
|
|
|
/*--------------------------------------------------------------------------------
|
|
* Constructors
|
|
*--------------------------------------------------------------------------------
|
|
*/
|
|
|
|
public BaseException()
|
|
{
|
|
super();
|
|
|
|
} // end constructor
|
|
|
|
public BaseException(String msg)
|
|
{
|
|
super(msg);
|
|
|
|
} // end constructor
|
|
|
|
public BaseException(Throwable inner)
|
|
{
|
|
super(inner.getMessage());
|
|
this.inner = inner;
|
|
|
|
} // end constructor
|
|
|
|
public BaseException(String msg, Throwable inner)
|
|
{
|
|
super(msg);
|
|
this.inner = inner;
|
|
|
|
} // end constructor
|
|
|
|
/*--------------------------------------------------------------------------------
|
|
* Overrides from class Throwable
|
|
*--------------------------------------------------------------------------------
|
|
*/
|
|
|
|
public void printStackTrace()
|
|
{
|
|
this.printStackTrace(System.err);
|
|
|
|
} // end printStackTrace
|
|
|
|
public void printStackTrace(PrintStream s)
|
|
{
|
|
super.printStackTrace(s);
|
|
if (inner!=null)
|
|
{ // print the inner stack trace
|
|
s.print("Root cause: ");
|
|
inner.printStackTrace(s);
|
|
|
|
} // end if
|
|
|
|
} // end printStackTrace
|
|
|
|
public void printStackTrace(PrintWriter s)
|
|
{
|
|
super.printStackTrace(s);
|
|
if (inner!=null)
|
|
{ // print the inner stack trace
|
|
s.print("Root cause: ");
|
|
inner.printStackTrace(s);
|
|
|
|
} // end if
|
|
|
|
} // end printStackTrace
|
|
|
|
/*--------------------------------------------------------------------------------
|
|
* External operations
|
|
*--------------------------------------------------------------------------------
|
|
*/
|
|
|
|
public Throwable getException()
|
|
{
|
|
return inner;
|
|
|
|
} // end getException
|
|
|
|
} // end class BaseException
|