JavaScriptKit Documentation

Class JSError

public final class JSError: Error, JSBridgedClass  

A wrapper around the JavaScript Error class that exposes its properties in a type-safe way.

%11 JSError JSError CustomStringConvertible CustomStringConvertible JSError->CustomStringConvertible Error Error JSError->Error JSBridgedClass JSBridgedClass JSError->JSBridgedClass

Conforms To

JSBridgedClass

Conform to this protocol when your Swift class wraps a JavaScript class.

CustomStringConvertible
Error

Initializers

init(message:​)

public init(message: String)  

Creates a new instance of the JavaScript Error class with a given message.

init(unsafely​Wrapping:​)

public init(unsafelyWrapping jsObject: JSObject)  

Properties

constructor

public static let constructor = JSObject.global.Error.function

The constructor function used to create new JavaScript Error objects.

js​Object

public let jsObject: JSObject

The underlying JavaScript Error object.

message

public var message: String  

The error message of the underlying Error object.

name

public var name: String  

The name (usually corresponds to the name of the underlying class) of a given error.

stack

public var stack: String?  

The JavaScript call stack that led to the creation of this error object.

js​Value

public var jsValue: JSValue  

Creates a new JSValue from this JSError instance.

description

public var description: String  

The textual representation of this error.