Throwable

extern class java.lang.Throwableimplements SerializableAvailable in java function new() : Void function addSuppressed( param1 : Throwable ) : VoidAppends the specified exception to the exceptions that were suppressed in order to deliver this exception. This method is thread-safe and typically called (automatically and implicitly) by the {@code try}-with-resources statement.
<p>The suppression behavior is enabled <em>unless</em> disabled {@linkplain #Throwable(String, Throwable, boolean, boolean) via a constructor}. When suppression is disabled, this method does nothing other than to validate its argument.
<p>Note that when one exception {@linkplain #initCause(Throwable) causes} another exception, the first exception is usually caught and then the second exception is thrown in response. In other words, there is a causal connection between the two exceptions.
In contrast, there are situations where two independent exceptions can be thrown in sibling code blocks, in particular in the {@code try} block of a {@code try}-with-resources statement and the compiler-generated {@code finally} block which closes the resource.
In these situations, only one of the thrown exceptions can be propagated. In the {@code try}-with-resources statement, when there are two such exceptions, the exception originating from the {@code try} block is propagated and the exception from the {@code finally} block is added to the list of exceptions suppressed by the exception from the {@code try} block. As an exception unwinds the stack, it can accumulate multiple suppressed exceptions.
<p>An exception may have suppressed exceptions while also being caused by another exception. Whether or not an exception has a cause is semantically known at the time of its creation, unlike whether or not an exception will suppress other exceptions which is typically only determined after an exception is thrown.
<p>Note that programmer written code is also able to take advantage of calling this method in situations where there are multiple sibling exceptions and only one can be propagated.
param exception the exception to be added to the list of suppressed exceptions throws IllegalArgumentException if {@code exception} is this throwable; a throwable cannot suppress itself. @throws NullPointerException if {@code exception} is {@code null} @since 1.7
function fillInStackTrace() : Throwable function getCause() : Throwable function getLocalizedMessage() : String function getMessage() : String function getStackTrace() : NativeArray<StackTraceElement> function getSuppressed() : NativeArray<Throwable>Returns an array containing all of the exceptions that were suppressed, typically by the {@code try}-with-resources statement, in order to deliver this exception.
If no exceptions were suppressed or {@linkplain #Throwable(String, Throwable, boolean, boolean) suppression is disabled}, an empty array is returned. This method is thread-safe. Writes to the returned array do not affect future calls to this method.
return an array containing all of the exceptions that were suppressed to deliver this exception. since 1.7
function initCause( param1 : Throwable ) : Throwable function printStackTrace() : Void function setStackTrace( param1 : NativeArray<StackTraceElement> ) : Void function toString() : StringReturns a short description of this throwable. The result is the concatenation of: <ul> <li> the {@linkplain Class#getName() name} of the class of this object <li> ": " (a colon and a space) <li> the result of invoking this object's {@link #getLocalizedMessage} method </ul> If {@code getLocalizedMessage} returns {@code null}, then just the class name is returned.
@return a string representation of this throwable.
version #18681, modified 2013-05-08 10:55:42 by api
0 comment