diff options
Diffstat (limited to 'src/com/memberwebs/ldapxml/LXException.java')
-rw-r--r-- | src/com/memberwebs/ldapxml/LXException.java | 68 |
1 files changed, 65 insertions, 3 deletions
diff --git a/src/com/memberwebs/ldapxml/LXException.java b/src/com/memberwebs/ldapxml/LXException.java index 242e081..e7a14f6 100644 --- a/src/com/memberwebs/ldapxml/LXException.java +++ b/src/com/memberwebs/ldapxml/LXException.java @@ -1,7 +1,5 @@ package com.memberwebs.ldapxml; -import com.familymembers.util.*; - /** * Thrown when an error occurs during LX retrieval or * processing. @@ -10,7 +8,7 @@ import com.familymembers.util.*; * @version 1.0 */ public class LXException - extends WrappedException + extends Exception { /** * Creates a new LXException object. @@ -31,4 +29,68 @@ public class LXException { super(null, e); } + + /** + * Creates a new WrappedException with a message and an + * exception exception held internally. + * + * @param message The message to include. + * @param e The internal exception. + */ + public LXException(String message, Exception e) + { + super(message); + if(e != null) + m_exception = e; + } + + /** + * Returns the error message of this exception if present, or + * the internal exception. + * + * @return The message. + */ + public String getMessage() + { + String message = super.getMessage(); + + if(message == null && m_exception != null) + message = m_exception.getMessage(); + + return message; + } + + /** + * Returns the internal exception, or this if not present. + * + * @return The exception. + */ + public Exception getException() + { + if(m_exception == null) + return this; + else + return m_exception; + } + + /** + * Converts this object to a string. + * + * @return The string value. + */ + public String toString () + { + if(m_exception != null) + return m_exception.toString(); + else + return super.toString(); + } + + public StackTraceElement[] getStackTrace() + { + return getStackTrace(); + } + + // The internal exception + private Exception m_exception; }
\ No newline at end of file |