Skip to content

Commit

Permalink
Check that all errors are instances of Object
Browse files Browse the repository at this point in the history
Part of rustwasm#670
  • Loading branch information
kraai committed Aug 16, 2018
1 parent f8354b3 commit c8d0c57
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions crates/js-sys/tests/wasm/RangeError.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ fn range_error() {
let error = RangeError::new("out of range yo");
assert!(error.is_instance_of::<RangeError>());
assert!(error.is_instance_of::<Error>());
assert!(error.is_instance_of::<Object>());

let base: &Error = error.as_ref();
assert_eq!(JsValue::from(base.message()), "out of range yo");
Expand Down
1 change: 1 addition & 0 deletions crates/js-sys/tests/wasm/ReferenceError.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ fn reference_error() {
let error = ReferenceError::new("bad reference, fool");
assert!(error.is_instance_of::<ReferenceError>());
assert!(error.is_instance_of::<Error>());
assert!(error.is_instance_of::<Object>());

let base: &Error = error.as_ref();
assert_eq!(JsValue::from(base.message()), "bad reference, fool");
Expand Down
1 change: 1 addition & 0 deletions crates/js-sys/tests/wasm/SyntaxError.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ fn syntax_error() {
let error = SyntaxError::new("msg");
assert!(error.is_instance_of::<SyntaxError>());
assert!(error.is_instance_of::<Error>());
assert!(error.is_instance_of::<Object>());

let base: &Error = error.as_ref();
assert_eq!(JsValue::from(base.message()), "msg");
Expand Down
1 change: 1 addition & 0 deletions crates/js-sys/tests/wasm/TypeError.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ fn type_error() {
let error = TypeError::new("msg");
assert!(error.is_instance_of::<TypeError>());
assert!(error.is_instance_of::<Error>());
assert!(error.is_instance_of::<Object>());

let base: &Error = error.as_ref();
assert_eq!(JsValue::from(base.message()), "msg");
Expand Down
1 change: 1 addition & 0 deletions crates/js-sys/tests/wasm/UriError.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ fn uri_error() {
let error = UriError::new("msg");
assert!(error.is_instance_of::<UriError>());
assert!(error.is_instance_of::<Error>());
assert!(error.is_instance_of::<Object>());

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

0 comments on commit c8d0c57

Please sign in to comment.