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

Unified Diff: Source/bindings/v8/ExceptionMessages.cpp

Issue 38063003: Improve TypeError messages from failed array conversions. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Improve TypeError messages from failed array conversions. Created 7 years, 2 months 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
« no previous file with comments | « Source/bindings/v8/ExceptionMessages.h ('k') | Source/bindings/v8/V8Binding.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/v8/ExceptionMessages.cpp
diff --git a/Source/bindings/v8/ExceptionMessages.cpp b/Source/bindings/v8/ExceptionMessages.cpp
index e1d879fe97f450f8c8da47fa431fbe2bdd4aeb59..a6e5753f0f6a515312857d5567571f8586d17bca 100644
--- a/Source/bindings/v8/ExceptionMessages.cpp
+++ b/Source/bindings/v8/ExceptionMessages.cpp
@@ -58,9 +58,34 @@ String ExceptionMessages::failedToDelete(const String& property, const String& t
return "Failed to delete the '" + property + "' property from '" + type + "': " + detail;
}
-String ExceptionMessages::notASequenceType(const String& argument)
+String ExceptionMessages::notASequenceTypeArgumentOrValue(int argumentIndexOrValue)
{
- return argument + " argument is neither an array, nor does it have indexed properties.";
+ String kind(" argument");
+
+ String prefix;
+ switch (argumentIndexOrValue) {
+ case 1:
+ prefix = "First";
+ break;
+ case 2:
+ prefix = "Second";
+ break;
+ case 3:
+ prefix = "Third";
+ break;
+ default:
+ if (argumentIndexOrValue <= 0)
+ kind = "The value provided";
+ else
+ prefix = String::number(argumentIndexOrValue) + "th";
+ break;
+ }
+ return prefix + kind + " is neither an array, nor does it have indexed properties.";
+}
+
+String ExceptionMessages::notASequenceTypeProperty(const String& propertyName)
+{
+ return "'" + propertyName + "' property is neither an array, nor does it have indexed properties.";
}
String ExceptionMessages::notEnoughArguments(unsigned expected, unsigned provided)
« no previous file with comments | « Source/bindings/v8/ExceptionMessages.h ('k') | Source/bindings/v8/V8Binding.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698