ErrorFactory

JavaScript: Error Factory

All JavaScript exception intrinsics are expected to implement this interface on their companion object; this allows for dynamic extension/implementation of a given JS exception, based on an originating Java exception.

When constructing a JS error from a Java exception, Elide will attempt to use an appropriate JS error type, and will provide the maximum amount of developer ergonomics possible to identify where the error took place.

Parameters

T

type of JavaScript error implemented by this factory. Must implement AbstractJsException.

See also

for the regular object interface implemented for each JS exception type.

Inheritors

Functions

Link copied to clipboard
abstract fun create(error: Throwable): T

Create a JavaScript-environment error of type T (an AbstractJsException) which wraps the provided Throwable. Any non-private fields and information on the provided Throwable will be included with the JS error.

abstract fun create(message: String, cause: Throwable? = null): T

Create a JavaScript-environment error of type T (an AbstractJsException) which wraps the provided message string and optional Throwable. Any non-private fields and information on the provided Throwable, if present, will be included with the JS error.