Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(177)

Unified Diff: Source/bindings/scripts/code_generator_v8.pm

Issue 36843003: Improve remaining TypeErrors in bindings code. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: vibration. Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/bindings/scripts/code_generator_v8.pm
diff --git a/Source/bindings/scripts/code_generator_v8.pm b/Source/bindings/scripts/code_generator_v8.pm
index 81f52cfdffed82300b39d81630b8403fb146b145..5c3527621c68c66e2a6cc1e0fe98a3ec630dd6d5 100644
--- a/Source/bindings/scripts/code_generator_v8.pm
+++ b/Source/bindings/scripts/code_generator_v8.pm
@@ -2016,7 +2016,7 @@ END
if ($returnSvgNativeType) {
$code .= <<END;
if (!$expression) {
- throwUninformativeAndGenericTypeError(info.GetIsolate());
+ throwTypeError(ExceptionMessages::failedToSet(\"${attrName}\", \"${interfaceName}\", \"The provided value is not of type '$returnType'.\"), info.GetIsolate());
return;
}
END
@@ -2246,7 +2246,7 @@ END
$code .= " }\n";
}
$code .= <<END;
- throwUninformativeAndGenericTypeError(info.GetIsolate());
+ throwTypeError(ExceptionMessages::failedToExecute(\"$name\", \"$interfaceName\", \"No function was found that matched the signature provided.\"), info.GetIsolate());
END
$code .= "}\n\n";
$code .= "#endif // ${conditionalString}\n\n" if $conditionalString;
@@ -2689,7 +2689,7 @@ END
$code .= " }\n";
}
$code .= <<END;
- throwUninformativeAndGenericTypeError(info.GetIsolate());
+ throwTypeError(ExceptionMessages::failedToConstruct(\"$interfaceName\", \"No matching constructor signature.\"), info.GetIsolate());
return;
END
$code .= "}\n\n";
@@ -5135,6 +5135,7 @@ sub GenerateFunctionCallString
$nativeReturnType = GetSVGWrappedTypeNeedingTearOff($returnType) if $isSVGTearOffType;
my $index = 0;
+ my $humanFriendlyIndex = $index + 1;
my @arguments;
my $functionName;
@@ -5155,6 +5156,8 @@ sub GenerateFunctionCallString
$code .= $subCode;
unshift(@arguments, @$callWithArgs);
$index += @$callWithArgs;
+ $humanFriendlyIndex = $index + 1;
+
$numberOfParameters += @$callWithArgs;
foreach my $parameter (@{$function->parameters}) {
@@ -5169,11 +5172,11 @@ sub GenerateFunctionCallString
} elsif ($parameter->type eq "NodeFilter" || $parameter->type eq "XPathNSResolver") {
push @arguments, "$paramName.get()";
} elsif (IsSVGTypeNeedingTearOff($parameter->type) and not $interfaceName =~ /List$/) {
- AddToImplIncludes("core/dom/ExceptionCode.h");
+ AddToImplIncludes("bindings/v8/ExceptionMessages.h");
push @arguments, "$paramName->propertyReference()";
$code .= <<END;
if (!$paramName) {
- throwUninformativeAndGenericTypeError(info.GetIsolate());
+ throwTypeError(ExceptionMessages::failedToExecute(\"$name\", \"$interfaceName\", \"parameter $humanFriendlyIndex is not of type '${ \$parameter->type }'.\"), info.GetIsolate());
return;
}
END
@@ -5185,6 +5188,7 @@ END
push @arguments, $paramName;
}
$index++;
+ $humanFriendlyIndex = $index + 1;
}
if ($function->extendedAttributes->{"RaisesException"}) {
« no previous file with comments | « LayoutTests/vibration/vibration-exceptions-expected.txt ('k') | Source/bindings/tests/results/V8TestObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698