We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 472132f commit 8c399adCopy full SHA for 8c399ad
Sources/JavaScript/JSError.swift
@@ -20,9 +20,17 @@ public struct JSError: Error, CustomStringConvertible {
20
init(context: JSContextRef, pointer: JSValueRef) {
21
let value = JSValue(context: context, pointer: pointer)
22
do {
23
- self.description = try value.toString()
+ guard value.isObject else {
24
+ description = "not an object"
25
+ return
26
+ }
27
+ guard let message = value["message"] else {
28
+ self.description = "failed to access error.message"
29
30
31
+ self.description = try message.toString()
32
} catch {
- self.description = "\(error)"
33
+ self.description = "failed to convert JSError"
34
}
35
36
0 commit comments