Source code: org/jbossmx/cluster/watchdog/HermesException.java
1 /**
2 * JBoss, the OpenSource EJB server
3 *
4 * Distributable under LGPL license Version 2.1, February 1999.
5 * See terms of license at gnu.org.
6 */
7
8 package org.jbossmx.cluster.watchdog;
9
10 /**
11 * Exception class to use for progating exception outside of Hermes
12 *
13 * @author Stacy Curl
14 */
15 public class HermesException
16 extends Exception
17 {
18 /**
19 * Constructor for HermesException
20 *
21 * @param reason the reason for the exception
22 * @param source
23 */
24 public HermesException(String reason, Exception source)
25 {
26 m_reason = reason;
27 m_source = source;
28 }
29
30 public String getMessage()
31 {
32 return ( this.toString() );
33 }
34
35 public String toString() {
36
37 StringBuffer buffer = new StringBuffer();
38
39 buffer.append( m_reason );
40
41 if ( m_source != null ) {
42 buffer.append( " because " );
43 buffer.append( m_source.getMessage() );
44 }
45
46 return buffer.toString();
47 }
48
49 protected String m_reason;
50 protected Exception m_source;
51 }