Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion IntegrationTests/TestSuites/Sources/PrimaryTests/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -487,9 +487,12 @@ try test("Promise") {

try test("Error") {
let message = "test error"
let expectedDescription = "Error: test error"
let error = JSError(message: message)
try expectEqual(error.name, "Error")
try expectEqual(error.message, message)
try expectEqual(error.description, "Error: test error")
try expectEqual(error.description, expectedDescription)
try expectEqual(error.stack?.isEmpty, false)
try expectEqual(JSError(from: .string("error"))?.description, nil)
try expectEqual(JSError(from: .object(error.jsObject))?.description, expectedDescription)
}
2 changes: 1 addition & 1 deletion Sources/JavaScriptKit/BasicObjects/JSError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
class](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) that
exposes its properties in a type-safe way.
*/
public final class JSError: Error, JSValueConvertible {
public final class JSError: Error, JSBridgedClass {
/// The constructor function used to create new JavaScript `Error` objects.
public static let constructor = JSObject.global.Error.function!

Expand Down