typeError

fun typeError(error: Throwable, raise: Boolean = false): TypeError

TypeError convenience function: wrap the provided error and optionally raise.

Return

Wrapped TypeError, ready to be raised.

Parameters

error

Throwable error to wrap as a TypeError.

raise

Whether to throw the error after wrapping. Defaults to false.


fun typeError(message: String, cause: Throwable? = null, raise: Boolean = false): TypeError

TypeError convenience function: wrap the provided message and optional cause; then, optionally raise.

Return

Wrapped TypeError, ready to be raised.

Parameters

message

String message for this error.

cause

Throwable error to wrap and consider the cause of this error.

raise

Whether to throw the error after wrapping. Defaults to false.


fun typeError(code: String, message: String, cause: Throwable? = null, raise: Boolean = false): TypeError

TypeError constructor for spec-compliant type errors which accept a code and message.

Return

Wrapped TypeError, ready to be raised.

Parameters

code

Code string for the error.

message

String message for this error.

cause

Throwable error to wrap and consider the cause of this error.

raise

Whether to throw the error after wrapping. Defaults to false.