1
2
3
4
5
6 package org.astrogrid.datacenter.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86