Add better stringifier for DOMException

This commit is contained in:
Manish Goregaokar 2015-09-16 07:10:48 +05:30
parent b677f0f4ae
commit 982e55ac1c
2 changed files with 7 additions and 0 deletions

View file

@ -104,4 +104,9 @@ impl DOMExceptionMethods for DOMException {
message.to_owned() message.to_owned()
} }
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-error.prototype.tostring
fn Stringifier(&self) -> String {
format!("{}: {}", self.Name(), self.Message())
}
} }

View file

@ -44,4 +44,6 @@ interface DOMException {
// A custom message set by the thrower. // A custom message set by the thrower.
readonly attribute DOMString message; readonly attribute DOMString message;
stringifier;
}; };