diff options
author | Nayeem Rahman <nayeemrmn99@gmail.com> | 2022-04-13 15:41:39 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-13 16:41:39 +0200 |
commit | 7d50a5fd4342969d261017b7a6dd0d0528e99a77 (patch) | |
tree | b9aa868213c082e189c6529351e195dee3f8a8aa /core/runtime.rs | |
parent | c03fbb3c1f58868e079a9bf21f8351ad599ea7b5 (diff) |
refactor(core/error): Clarify JsError message fields (#14269)
Diffstat (limited to 'core/runtime.rs')
-rw-r--r-- | core/runtime.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/core/runtime.rs b/core/runtime.rs index 7f7b6ead1..a6442ce97 100644 --- a/core/runtime.rs +++ b/core/runtime.rs @@ -1053,9 +1053,9 @@ pub(crate) fn exception_to_err_result<'s, T>( let mut js_error = JsError::from_v8_exception(scope, exception); if in_promise { - js_error.message = format!( + js_error.exception_message = format!( "Uncaught (in promise) {}", - js_error.message.trim_start_matches("Uncaught ") + js_error.exception_message.trim_start_matches("Uncaught ") ); } let js_error = (state.js_error_create_fn)(js_error); @@ -2044,7 +2044,7 @@ pub mod tests { .unwrap(); let v = runtime.poll_value(&value_global, cx); assert!( - matches!(v, Poll::Ready(Err(e)) if e.downcast_ref::<JsError>().unwrap().message == "Uncaught Error: fail") + matches!(v, Poll::Ready(Err(e)) if e.downcast_ref::<JsError>().unwrap().exception_message == "Uncaught Error: fail") ); let value_global = runtime @@ -2087,7 +2087,7 @@ pub mod tests { let err = runtime.resolve_value(value_global).await.unwrap_err(); assert_eq!( "Uncaught Error: fail", - err.downcast::<JsError>().unwrap().message + err.downcast::<JsError>().unwrap().exception_message ); let value_global = runtime @@ -2377,7 +2377,7 @@ pub mod tests { .expect_err("script should fail"); assert_eq!( "Uncaught Error: execution terminated", - err.downcast::<JsError>().unwrap().message + err.downcast::<JsError>().unwrap().exception_message ); assert!(callback_invoke_count.load(Ordering::SeqCst) > 0) } @@ -2430,7 +2430,7 @@ pub mod tests { .expect_err("script should fail"); assert_eq!( "Uncaught Error: execution terminated", - err.downcast::<JsError>().unwrap().message + err.downcast::<JsError>().unwrap().exception_message ); assert_eq!(0, callback_invoke_count_first.load(Ordering::SeqCst)); assert!(callback_invoke_count_second.load(Ordering::SeqCst) > 0); |