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