Structurejavascriptkit 0.23.0JavaScriptKit
JSException
JSException
is a wrapper that handles exceptions thrown during JavaScript execution as Swift Error
objects. When a JavaScript function throws an exception, it’s wrapped as a JSException
and propagated through Swift’s error handling mechanism.
struct JSException
Example:
do {
try jsFunction.throws()
} catch let error as JSException {
// Access the value thrown from JavaScript
let jsErrorValue = error.thrownValue
}