View Javadoc

1   /*
2    * $Id DatabaseAccessException.java $
3    *
4    */
5   
6   package org.astrogrid.dataservice.queriers;
7   
8   import java.io.IOException;
9   
10  
11  /***
12   * An exception for generation by plugins
13   * <p>
14   * The original exception should wherever possible be preserved as the cause
15   * <p>
16   * I would have much rather used IOException directly instead of making a new one,
17   * but for some reason IOException has no easy constructor that takes a cause.
18   *
19   * @author M Hill
20   */
21  
22  public class QuerierPluginException extends IOException
23  {
24     /***
25      * Constructor taking the cause of the error (an exception/error) and
26      * a message describing the context
27      */
28     public QuerierPluginException(String message, Throwable cause)
29     {
30        super(message);
31        initCause(cause);
32     }
33  
34     /***
35      * Convenience constructor that just takes the cause of the error
36      */
37     public QuerierPluginException(Throwable cause)
38     {
39        super("");
40        initCause(cause);
41     }
42  
43     /***
44      * THis constructor should NOT be used when catching & rethrowing
45      * exceptions - in such cases use a constructor which takes a throwable, to
46      * preserve the original information
47      */
48     public QuerierPluginException(String message)
49     {
50        super(message);
51     }
52     
53     public static void main(String args[]) throws QuerierPluginException
54     {
55        throw new QuerierPluginException("QPE Message", new IOException("IOE"));
56     }
57     
58  }
59  
60  /*
61  $Log: QuerierPluginException.java,v $
62  Revision 1.1.1.1  2005/02/17 18:37:35  mch
63  Initial checkin
64  
65  Revision 1.1.1.1  2005/02/16 17:11:24  mch
66  Initial checkin
67  
68  Revision 1.1  2004/09/28 15:02:13  mch
69  Merged PAL and server packages
70  
71  Revision 1.1  2004/03/12 04:45:26  mch
72  It05 MCH Refactor
73  
74  Revision 1.3  2003/12/03 17:58:25  mch
75  Fixed initCause error
76  
77  Revision 1.2  2003/12/03 16:05:46  mch
78  Now extends RemoteException which should give better error reporting at the web client
79  
80  Revision 1.1  2003/11/14 00:38:29  mch
81  Code restructure
82  
83  Revision 1.3  2003/09/08 16:34:31  mch
84  Added documentation
85  
86  Revision 1.2  2003/09/07 18:54:47  mch
87  Fix for null causes
88  
89  Revision 1.1  2003/08/27 17:34:56  mch
90  Now subclassed (more appropriately) from IOException
91  
92  */