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

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

Issue 211333004: Tidy up error reporting for calling-constructor-as-function. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: re-use failedToConstruct() in constructorNotCallableAsFunction(). Created 6 years, 9 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/tests/results/V8TestTypedefs.cpp ('k') | Source/bindings/v8/ExceptionMessages.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/v8/ExceptionMessages.h
diff --git a/Source/bindings/v8/ExceptionMessages.h b/Source/bindings/v8/ExceptionMessages.h
index 85475609e719c741a9c2f58cb17abdb2d7b722a7..f78a6f4a971b883b784c70a4915ec18fd061b6d2 100644
--- a/Source/bindings/v8/ExceptionMessages.h
+++ b/Source/bindings/v8/ExceptionMessages.h
@@ -46,9 +46,12 @@ public:
ExclusiveBound,
};
- static String failedToConstruct(const String& type, const String& detail = String());
- static String failedToEnumerate(const String& type, const String& detail = String());
- static String failedToExecute(const String& method, const String& type, const String& detail = String());
+ static String argumentNullOrIncorrectType(int argumentIndex, const String& expectedType);
+ static String constructorNotCallableAsFunction(const String& type);
+
+ static String failedToConstruct(const String& type, const String& detail);
+ static String failedToEnumerate(const String& type, const String& detail);
+ static String failedToExecute(const String& method, const String& type, const String& detail);
static String failedToGet(const String& property, const String& type, const String& detail);
static String failedToSet(const String& property, const String& type, const String& detail);
static String failedToDelete(const String& property, const String& type, const String& detail);
@@ -56,20 +59,13 @@ public:
static String failedToSetIndexed(const String& type, const String& detail);
static String failedToDeleteIndexed(const String& type, const String& detail);
- static String incorrectPropertyType(const String& property, const String& detail);
-
- static String argumentNullOrIncorrectType(int argumentIndex, const String& expectedType);
-
- // If > 0, the argument index that failed type check (1-indexed.)
- // If == 0, a (non-argument) value (e.g., a setter) failed the same check.
- static String notAnArrayTypeArgumentOrValue(int argumentIndex);
- static String notASequenceTypeProperty(const String& propertyName);
- static String notAFiniteNumber(double value, const char* name = "value provided");
- static String notAFiniteNumber(const Decimal& value, const char* name = "value provided");
-
- static String notEnoughArguments(unsigned expected, unsigned providedleastNumMandatoryParams);
+ template <typename NumType>
+ static String formatNumber(NumType number)
+ {
+ return formatFiniteNumber(number);
+ }
- static String readOnly(const char* detail = 0);
+ static String incorrectPropertyType(const String& property, const String& detail);
template <typename NumberType>
static String indexExceedsMaximumBound(const char* name, NumberType given, NumberType bound)
@@ -123,16 +119,18 @@ public:
return result.toString();
}
- template <typename NumType>
- static String formatNumber(NumType number)
- {
- return formatFiniteNumber(number);
- }
+ // If > 0, the argument index that failed type check (1-indexed.)
+ // If == 0, a (non-argument) value (e.g., a setter) failed the same check.
+ static String notAnArrayTypeArgumentOrValue(int argumentIndex);
+ static String notASequenceTypeProperty(const String& propertyName);
+ static String notAFiniteNumber(double value, const char* name = "value provided");
+ static String notAFiniteNumber(const Decimal& value, const char* name = "value provided");
-private:
- static String ordinalNumber(int number);
+ static String notEnoughArguments(unsigned expected, unsigned providedleastNumMandatoryParams);
+ static String readOnly(const char* detail = 0);
+private:
template <typename NumType>
static String formatFiniteNumber(NumType number)
{
@@ -152,6 +150,8 @@ private:
return String::format("%e", number);
return String::number(number);
}
+
+ static String ordinalNumber(int number);
};
template <> String ExceptionMessages::formatNumber<float>(float number);
« no previous file with comments | « Source/bindings/tests/results/V8TestTypedefs.cpp ('k') | Source/bindings/v8/ExceptionMessages.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698