aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/bindings/error.rs
diff options
context:
space:
mode:
authorMs2ger <Ms2ger@gmail.com>2016-11-26 22:54:43 +0100
committerMs2ger <Ms2ger@gmail.com>2016-11-27 10:27:11 +0100
commit154b16a25ddaef753f3fac0a70b035646b2ce201 (patch)
treebbdd9733d583f1ad3a3e7b304a132ece745088fe /components/script/dom/bindings/error.rs
parentc4f87f451faf8eeac3e046c38ebf8b9b3dd0051e (diff)
downloadservo-154b16a25ddaef753f3fac0a70b035646b2ce201.tar.gz
servo-154b16a25ddaef753f3fac0a70b035646b2ce201.zip
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.
Diffstat (limited to 'components/script/dom/bindings/error.rs')
-rw-r--r--components/script/dom/bindings/error.rs19
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))) => {