org.jlf.log
Class AppError

java.lang.Object
  |
  +--java.lang.Throwable
        |
        +--java.lang.Exception
              |
              +--java.lang.RuntimeException
                    |
                    +--org.jlf.log.AppError
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
DataMapError, HttpRequestProcessorError

public class AppError
extends java.lang.RuntimeException

The AppError class is to be used for handling all exceptions that need to be "bubbled" up to the user interface. When using try-catch on a checked exception the AppError class can be used to "wrap" the original exception and provide a user friendly message for display. It is a subclass of RuntimeException so there is no need to handle it with a try-catch block, thereby helping to streamline your code. This class also supports automatic logging of the error, with a stack trace, to the log of your choice.

See Also:
Serialized Form

Field Summary
protected  java.lang.Throwable originalThrownObject
          Holds a reference to the original Error or Exception object.
 
Constructor Summary
AppError()
          Empty constructor to create an AppError with no message.
AppError(java.lang.String s)
          Constructor accepting a message string.
AppError(java.lang.String s, java.lang.Throwable t)
          Constructor accepting a message and a Throwable object.
AppError(java.lang.String s, java.lang.Throwable t, Log log, int loggingLevel)
          Constructor accepting a message, a Throwable object, and logging information.
AppError(java.lang.Throwable t)
          Constructor accepting a reference to a Throwable object.
 
Method Summary
 java.lang.Throwable getOriginalThrownObject()
          Returns the original thrown object.
static java.lang.String getStackTraceAsString(java.lang.Throwable e)
          Takes the Throwable given as input, generates a stack trace, and converts it to a string to be returned.
 java.lang.String toString()
          Returns a String representing the AppError information.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

originalThrownObject

protected java.lang.Throwable originalThrownObject
Holds a reference to the original Error or Exception object.

Constructor Detail

AppError

public AppError()
Empty constructor to create an AppError with no message.


AppError

public AppError(java.lang.Throwable t)
Constructor accepting a reference to a Throwable object. This is normally used when using the AppError to "wrap" a caught exception.


AppError

public AppError(java.lang.String s)
Constructor accepting a message string.


AppError

public AppError(java.lang.String s,
                java.lang.Throwable t)
Constructor accepting a message and a Throwable object. This is normally used when using the AppError to "wrap" a caught exception.


AppError

public AppError(java.lang.String s,
                java.lang.Throwable t,
                Log log,
                int loggingLevel)
Constructor accepting a message, a Throwable object, and logging information. Use this message to automatically construct the exception, generate message text and a stack trace, and log it all to the log and logging level given as input.

Method Detail

getStackTraceAsString

public static java.lang.String getStackTraceAsString(java.lang.Throwable e)
Takes the Throwable given as input, generates a stack trace, and converts it to a string to be returned.


getOriginalThrownObject

public java.lang.Throwable getOriginalThrownObject()
Returns the original thrown object. The AppError is "wrapping" it.


toString

public java.lang.String toString()
Returns a String representing the AppError information.

Overrides:
toString in class java.lang.Throwable