????
+--Error
+--org.as2lib.env.except.AbstractThrowable
AbstractThrowable is an abstract class that contains sourced out
functionalities used by the classes Exception and
FatalException.
It is thought to be an abstract implementation of the Throwable
interface. Because of that sub-classes must implement the Throwable
interface if they are themselves not abstract.
This class extends the Error class. Thus you can use sub-classes of
it as throwable type in catch-blocks in Flex.
static public function getStringifier(Void):StringifierReturns the stringifier to stringify throwables.
The returned stringifier is either the default
ThrowableStringifier if no custom stringifier was set or if the
stringifier was set to null.
the current stringifier
static public function setStringifier(throwableStringifier:Stringifier):VoidSets the stringifier to stringify throwables.
If throwableStringifier is null the static
getStringifier method will return the default stringifier.
throwableStringifier | the stringifier to stringify throwables |
public function addStackTraceElement(thrower, method:Function, args:Array):VoidAdds a stack trace element to the stack trace.
The new stack trace element is added to the end of the stack trace.
At some parts in your application you may want to add stack trace elements manually. This can help you to get a clearer image of what went where wrong and why. You can use this method to do so.
thrower | the object that threw, rethrew or forwarded (let pass) the throwable |
method | the method that threw, rethrew or forwarded (let pass) the throwable |
args | the arguments the method was invoked with when throwing, rethrowing or forwarding (leting pass) the throwable |
public function getStackTrace(Void):ArrayReturns an array that contains StackTraceElement instances of the methods invoked before this throwable was thrown.
The last element is always the one that contains the actual method that threw the throwable.
The stack trace helps you a lot because it says you where the throwing of the throwable took place and also what arguments caused the throwing.
The returned stack trace is never null or undefined. If
no stack trace element has been set an empty array is returned.
a stack containing the invoked methods until the throwable was thrown
public function getCause(Void)Returns the initialized cause.
The cause is the throwable that caused this throwable to be thrown.
the initialized cause
public function initCause(newCause):ThrowableInitializes the cause of this throwable.
The cause can only be initialized once. You normally initialize a cause if you throw a throwable due to the throwing of another throwable. Thereby you do not lose the information the cause offers.
This method returns this throwable to have an easy way to initialize the
cause. Following is how you could use the cause mechanism.
try {
myInstance.invokeMethodThatThrowsAThrowable();
} catch (e:org.as2lib.env.except.Throwable) {
throw new MyThrowable("myMessage", this, arguments).initCause(e);
}
this throwable itself
| IllegalArgumentException | if the passed-in
newCause is null or undefined
|
| IllegalStateException | if the cause has already been initialized |
public function getMessage(Void):StringReturns the message that describes in detail what went wrong.
The message should be understandable, even for non-programmers. It should contain detailed information about what went wrong. And maybe also how the user that sees this message can solve the problem.
If the throwable was thrown for example because of a wrong collaborator or an illegal string or something similar, provide the string representation of it in the error message. It is recommended to put these between []-characters.
the message that describes the problem in detail