1   /*
2    *  GateException.java
3    *
4    *  Copyright (c) 1998-2001, The University of Sheffield.
5    *
6    *  This file is part of GATE (see http://gate.ac.uk/), and is free
7    *  software, licenced under the GNU Library General Public License,
8    *  Version 2, June 1991 (in the distribution as file licence.html,
9    *  and also available at http://gate.ac.uk/gate/licence.html).
10   *
11   *  Hamish Cunningham, 19/01/2000
12   *
13   *  $Id: GateException.java,v 1.8 2001/07/05 12:05:03 valyt Exp $
14   */
15  
16  package gate.util;
17  
18  import java.io.PrintStream;
19  
20  /** A superclass for exceptions in the GATE packages. Can be used
21    * to catch any internal exception thrown by the GATE libraries.
22    * (Of course
23    * other types of exception may be thrown, but these will be from other
24    * sources such as the Java core API.)
25    */
26  public class GateException extends Exception {
27  
28    /** Debug flag */
29    private static final boolean DEBUG = false;
30  
31    protected Exception e;
32  
33    public GateException() {
34      super();
35    }
36  
37    public GateException(String s) {
38      super(s);
39    }
40  
41    public GateException(Exception e) {
42      super(e.toString());
43      this.e = e;
44    }
45  
46    public void printStackTrace(){
47      printStackTrace(System.err);
48    }
49  
50    public void printStackTrace(PrintStream s){
51      super.printStackTrace(s);
52      if(e!= null){
53        System.err.println("From:");
54        e.printStackTrace(s);
55      }
56    }
57  } // GateException
58