mirror of
https://github.com/servo/servo.git
synced 2025-06-08 08:33:26 +00:00
Throw a TypeError when unwrapping an interface argument fails.
This commit is contained in:
parent
7f707020be
commit
715ae6ab55
2 changed files with 17 additions and 4 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue