Class org.as2lib.env.except.FatalException

????
   +--Error
      +--org.as2lib.env.except.AbstractThrowable
         +--org.as2lib.env.except.FatalException

Implemented Interfaces

Throwable

Description

FatalException is a default implementation of the Throwable interface.

It differs from the Exception class in that it marks the throwable as fatal. That means it differs from a normal Exception in its fatality.

It also uses the Logger.fatal method to log itself, while the Exception class uses the Logger.error method.

Example: throw new FatalException("This is a detailed message that explains the problem.", this, arguments);

The above example is supposed to be in a method, that has been declared on a class.

Note that you normally do not throw instances of this class directly. It is better to sub-class it, that means to create a custom exception, that explains its purpose more closely by its name, and throw this exception instead.

If you are building a framework that shall be reused it is also helpful to built a exception inheritance hierarchy, where you have one base class. You can then categorize different exceptions by their inheritance hierarchy. This enables you to catch all exceptions from your whole framework or only from specific parts of your framework.

For a detailed explanation on how to use throwables, what this exception framework offers you and how to work appropriately with throwables take a look at the class documentation of the Throwable interface.

Method Index

new FatalException()

toString()

Inherited from AbstractThrowable

addStackTraceElement(), getCause(), getMessage(), getStackTrace(), getStringifier(), initCause(), setStringifier()

Constructor Detail

FatalException

public function FatalException(message:String, thrower, args:Array)

Constructs a new FatalException instance.

All arguments are allowed to be null or undefined. But if one is, the string representation returned by the toString method will not be complete.

The args array should be the internal arguments array of the method that throws the throwable. The internal arguments array exists in every method and contains its parameters, the callee method and the caller method. You can refernce it in every method using the name "arguments".

Parameters

messagethe message that describes the problem in detail
throwerthe object that declares the method that throws this fatal exception
argsthe arguments of the throwing method

Method Detail

toString

public function toString():String

Returns the string representation of this fatal exception.

If you do not call this method out of another method, it also executes the fatal method of the logger returned by the AbstractThrowable.getLogger method passing this because it thinks that the virtual machine called this method.

The string representation is obtained via the invocation of the AbstractThrowable.doToString method that uses the stringifier returned by the static AbstractThrowable.getStringifier method.

If you want to change the appearance of all exceptions set a new stringifier via the static AbstractThrowable.setStringifier method.

If you only want to change the string representation of one exception and its sub-classes overwrite the doToString method in your custom exception.

Do not overwrite this method because you will lose the functionality that invokes the logger when the exception has not been caught and has now reached the final 'level', the virtual machine, that invokes this method.

Return

the string representation of this fatal exception