diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2016-11-27 01:37:41 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-27 01:37:41 -0800 |
commit | 1888ffdb42f5b17e538ce17b81dde19908f4003e (patch) | |
tree | a2cc0cf689423892a4975f1e1703d8ab514e6ca4 /components/script/dom/bindings/error.rs | |
parent | 4755cb7586ab4a89f35bbccf8b57c85ed2f428e7 (diff) | |
parent | 154b16a25ddaef753f3fac0a70b035646b2ce201 (diff) | |
download | servo-1888ffdb42f5b17e538ce17b81dde19908f4003e.tar.gz servo-1888ffdb42f5b17e538ce17b81dde19908f4003e.zip |
Auto merge of #14375 - servo:error-info, r=nox
Don't return early from report_pending_exception() if the value is an unexpected object.
We will now dispatch the error event in this case as well.
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14375)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/bindings/error.rs')
-rw-r--r-- | components/script/dom/bindings/error.rs | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/components/script/dom/bindings/error.rs b/components/script/dom/bindings/error.rs index 3b179e85d1d..d38a55c31be 100644 --- a/components/script/dom/bindings/error.rs +++ b/components/script/dom/bindings/error.rs @@ -214,15 +214,16 @@ pub unsafe fn report_pending_exception(cx: *mut JSContext, dispatch_event: bool) JS_ClearPendingException(cx); let error_info = if value.is_object() { rooted!(in(cx) let object = value.to_object()); - let error_info = ErrorInfo::from_native_error(cx, object.handle()) - .or_else(|| ErrorInfo::from_dom_exception(object.handle())); - match error_info { - Some(error_info) => error_info, - None => { - error!("Uncaught exception: failed to extract information"); - return; - } - } + ErrorInfo::from_native_error(cx, object.handle()) + .or_else(|| ErrorInfo::from_dom_exception(object.handle())) + .unwrap_or_else(|| { + ErrorInfo { + message: format!("uncaught exception: unknown (can't convert to string)"), + filename: String::new(), + lineno: 0, + column: 0, + } + }) } else { match USVString::from_jsval(cx, value.handle(), ()) { Ok(ConversionResult::Success(USVString(string))) => { |