Skip to content

Commit c8d0c57

Browse files
committed
Check that all errors are instances of Object
Part of wasm-bindgen#670
1 parent f8354b3 commit c8d0c57

File tree

5 files changed

+5
-0
lines changed

5 files changed

+5
-0
lines changed

crates/js-sys/tests/wasm/RangeError.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ fn range_error() {
88
let error = RangeError::new("out of range yo");
99
assert!(error.is_instance_of::<RangeError>());
1010
assert!(error.is_instance_of::<Error>());
11+
assert!(error.is_instance_of::<Object>());
1112

1213
let base: &Error = error.as_ref();
1314
assert_eq!(JsValue::from(base.message()), "out of range yo");

crates/js-sys/tests/wasm/ReferenceError.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ fn reference_error() {
88
let error = ReferenceError::new("bad reference, fool");
99
assert!(error.is_instance_of::<ReferenceError>());
1010
assert!(error.is_instance_of::<Error>());
11+
assert!(error.is_instance_of::<Object>());
1112

1213
let base: &Error = error.as_ref();
1314
assert_eq!(JsValue::from(base.message()), "bad reference, fool");

crates/js-sys/tests/wasm/SyntaxError.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ fn syntax_error() {
88
let error = SyntaxError::new("msg");
99
assert!(error.is_instance_of::<SyntaxError>());
1010
assert!(error.is_instance_of::<Error>());
11+
assert!(error.is_instance_of::<Object>());
1112

1213
let base: &Error = error.as_ref();
1314
assert_eq!(JsValue::from(base.message()), "msg");

crates/js-sys/tests/wasm/TypeError.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ fn type_error() {
88
let error = TypeError::new("msg");
99
assert!(error.is_instance_of::<TypeError>());
1010
assert!(error.is_instance_of::<Error>());
11+
assert!(error.is_instance_of::<Object>());
1112

1213
let base: &Error = error.as_ref();
1314
assert_eq!(JsValue::from(base.message()), "msg");

crates/js-sys/tests/wasm/UriError.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ fn uri_error() {
88
let error = UriError::new("msg");
99
assert!(error.is_instance_of::<UriError>());
1010
assert!(error.is_instance_of::<Error>());
11+
assert!(error.is_instance_of::<Object>());
1112

1213
let base: &Error = error.as_ref();
1314
assert_eq!(JsValue::from(base.message()), "msg");

0 commit comments

Comments
 (0)