aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/script/dom/bindings/codegen
diff options
context:
space:
mode:
authorMs2ger <ms2ger@gmail.com>2014-08-04 15:27:56 +0200
committerMs2ger <ms2ger@gmail.com>2014-08-05 16:23:02 +0200
commit715ae6ab553cdd960a588f85ec67bc3419e4dc1f (patch)
tree33bf77b64510d109f4696ecde3958ac550b207fa /src/components/script/dom/bindings/codegen
parent7f707020be88ea93474ffc66a0687d61af7d9771 (diff)
downloadservo-715ae6ab553cdd960a588f85ec67bc3419e4dc1f.tar.gz
servo-715ae6ab553cdd960a588f85ec67bc3419e4dc1f.zip
Throw a TypeError when unwrapping an interface argument fails.
Diffstat (limited to 'src/components/script/dom/bindings/codegen')
-rw-r--r--src/components/script/dom/bindings/codegen/CodegenRust.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/components/script/dom/bindings/codegen/CodegenRust.py b/src/components/script/dom/bindings/codegen/CodegenRust.py
index 5ee43b18e8c..7de2d949efe 100644
--- a/src/components/script/dom/bindings/codegen/CodegenRust.py
+++ b/src/components/script/dom/bindings/codegen/CodegenRust.py
@@ -586,7 +586,15 @@ def getJSToNativeConversionTemplate(type, descriptorProvider, failureCode=None,
"argument" % descriptor.interface.identifier.name)
if failureCode is None:
- unwrapFailureCode = "return 0; //XXXjdm return Throw(cx, rv);"
+ substitutions = {
+ "sourceDescription": sourceDescription,
+ "interface": descriptor.interface.identifier.name,
+ "exceptionCode": exceptionCode,
+ }
+ unwrapFailureCode = string.Template(
+ 'throw_type_error(cx, "${sourceDescription} does not '
+ 'implement interface ${interface}.");\n'
+ '${exceptionCode}').substitute(substitutions)
else:
unwrapFailureCode = failureCode