1 package org.ejen; 22 23 28 public class EjenException extends RuntimeException { 29 protected EjenChildNode _ejenChildNode = null; 30 protected String _message = "(no message)"; 31 protected Throwable _embeddedThrowable = null; 32 33 38 public EjenException(EjenChildNode ejenChildNode, String message) { 39 this(ejenChildNode, message, null); 40 } 41 42 48 public EjenException(EjenChildNode ejenChildNode, String message, Throwable t) { 49 _ejenChildNode = ejenChildNode; 50 if (message != null) { 51 _message = message; 52 } 53 _embeddedThrowable = t; 54 } 55 56 69 public String getMessage() { 70 String nodeInfo = "(unknown node)"; 71 String embeddedThrowableString = ""; 72 73 if (_ejenChildNode != null) { 74 nodeInfo = _ejenChildNode.toString(); 75 } 76 if (_embeddedThrowable != null) { 77 embeddedThrowableString = " [" + _embeddedThrowable.toString() + "]"; 78 } 79 return nodeInfo + ": " + _message + embeddedThrowableString; 80 } 81 82 86 public Throwable getEmbeddedThrowable() { 87 return _embeddedThrowable; 88 } 89 90 94 public EjenChildNode getEjenChildNode() { 95 return _ejenChildNode; 96 } 97 98 102 public String getRawMessage() { 103 return _message; 104 } 105 } 106 | Popular Tags |