Chromium Code Reviews| Index: Source/bindings/v8/ExceptionMessages.cpp |
| diff --git a/Source/bindings/v8/ExceptionMessages.cpp b/Source/bindings/v8/ExceptionMessages.cpp |
| index e1d879fe97f450f8c8da47fa431fbe2bdd4aeb59..d317e91021fda6e259da465d38d971cfca173033 100644 |
| --- a/Source/bindings/v8/ExceptionMessages.cpp |
| +++ b/Source/bindings/v8/ExceptionMessages.cpp |
| @@ -58,9 +58,39 @@ 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::notASequenceType(int argumentIndex) |
| { |
| - return argument + " argument is neither an array, nor does it have indexed properties."; |
| + String kind(" argument"); |
| + |
| + String prefix; |
| + switch (argumentIndex) { |
| + case 1: |
| + prefix = "First"; |
| + break; |
| + case 2: |
| + prefix = "Second"; |
| + break; |
| + case 3: |
| + prefix = "Third"; |
| + break; |
| + default: |
| + if (argumentIndex <= 0) |
| + kind = "Value"; |
| + else |
| + prefix = String::number(argumentIndex) + "th"; |
| + break; |
| + } |
|
Mike West
2013/10/24 07:08:54
I've avoided this in other places by phrasing it a
sof
2013/10/24 21:16:41
I prefer "Second argument" (or "2nd argument") ove
|
| + return prefix + kind + " is neither an array, nor does it have indexed properties."; |
| +} |
| + |
| +String ExceptionMessages::notASequenceType(const String& argument, const String& kind) |
| +{ |
| + String prefix; |
| + if (kind.isEmpty()) |
| + prefix = argument + " argument"; |
| + else |
| + prefix = "'" + argument + "' " + kind; |
| + return prefix + " is neither an array, nor does it have indexed properties."; |
| } |
| String ExceptionMessages::notEnoughArguments(unsigned expected, unsigned provided) |