Throwable

open class Throwable (source)

The base class for all errors and exceptions. Only instances of this class can be thrown or caught.

Parameters

message - the detail message string.

cause - the cause of this throwable.

Constructors

<init>

Throwable(message: String?)
Throwable(cause: Throwable?)
Throwable()
Throwable(message: String?, cause: Throwable?)

The base class for all errors and exceptions. Only instances of this class can be thrown or caught.

Properties

cause

open val cause: Throwable?

message

open val message: String?

Inherited Functions

equals

open operator fun equals(other: Any?): Boolean

Indicates whether some other object is "equal to" this one. Implementations must fulfil the following requirements:

hashCode

open fun hashCode(): Int

Returns a hash code value for the object. The general contract of hashCode is:

toString

open fun toString(): String

Returns a string representation of the object.

Extension Properties

stackTrace

val Throwable.stackTrace: Array<StackTraceElement>

Returns an array of stack trace elements representing the stack trace pertaining to this throwable.

Extension Functions

addSuppressed

fun Throwable.addSuppressed(exception: Throwable)

When supported by the platform adds the specified exception to the list of exceptions that were suppressed in order to deliver this exception.

printStackTrace

fun Throwable.printStackTrace()

Prints the stack trace of this throwable to the standard output.

fun Throwable.printStackTrace(writer: PrintWriter)

Prints the stack trace of this throwable to the specified writer.

fun Throwable.printStackTrace(stream: PrintStream)

Prints the stack trace of this throwable to the specified stream.

Inheritors

Error

Error

Exception

Exception