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

Unified Diff: Source/core/css/CSSPrimitiveValue.cpp

Issue 128043003: Improve core/css exception messages. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Test. Created 6 years, 11 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/core/css/CSSMatrix.cpp ('k') | Source/core/css/CSSStyleSheet.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/CSSPrimitiveValue.cpp
diff --git a/Source/core/css/CSSPrimitiveValue.cpp b/Source/core/css/CSSPrimitiveValue.cpp
index 664e564bbea52402ae4cd673798fc3e6ce98badd..1d94d0b1aec8114fd61e322ba6f4dca4e941070c 100644
--- a/Source/core/css/CSSPrimitiveValue.cpp
+++ b/Source/core/css/CSSPrimitiveValue.cpp
@@ -615,7 +615,7 @@ void CSSPrimitiveValue::setFloatValue(unsigned short, double, ExceptionState& ex
// Keeping values immutable makes optimizations easier and allows sharing of the primitive value objects.
// No other engine supports mutating style through this API. Computed style is always read-only anyway.
// Supporting setter would require making primitive value copy-on-write and taking care of style invalidation.
- exceptionState.throwUninformativeAndGenericDOMException(NoModificationAllowedError);
+ exceptionState.throwDOMException(NoModificationAllowedError, "CSSPrimitiveValue objects are read-only.");
}
double CSSPrimitiveValue::conversionToCanonicalUnitsScaleFactor(unsigned short unitType)
@@ -675,7 +675,7 @@ double CSSPrimitiveValue::getDoubleValue(unsigned short unitType, ExceptionState
double result = 0;
bool success = getDoubleValueInternal(static_cast<UnitTypes>(unitType), &result);
if (!success) {
- exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessError);
+ exceptionState.throwDOMException(InvalidAccessError, "Failed to obtain a double value.");
return 0.0;
}
@@ -773,7 +773,7 @@ void CSSPrimitiveValue::setStringValue(unsigned short, const String&, ExceptionS
// Keeping values immutable makes optimizations easier and allows sharing of the primitive value objects.
// No other engine supports mutating style through this API. Computed style is always read-only anyway.
// Supporting setter would require making primitive value copy-on-write and taking care of style invalidation.
- exceptionState.throwUninformativeAndGenericDOMException(NoModificationAllowedError);
+ exceptionState.throwDOMException(NoModificationAllowedError, "CSSPrimitiveValue objects are read-only.");
}
String CSSPrimitiveValue::getStringValue(ExceptionState& exceptionState) const
@@ -789,7 +789,7 @@ String CSSPrimitiveValue::getStringValue(ExceptionState& exceptionState) const
case CSS_PROPERTY_ID:
return propertyName(m_value.propertyID);
default:
- exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessError);
+ exceptionState.throwDOMException(InvalidAccessError, "This object's value cannot be represented as a string.");
break;
}
@@ -818,7 +818,7 @@ String CSSPrimitiveValue::getStringValue() const
Counter* CSSPrimitiveValue::getCounterValue(ExceptionState& exceptionState) const
{
if (m_primitiveUnitType != CSS_COUNTER) {
- exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessError);
+ exceptionState.throwDOMException(InvalidAccessError, "This object is not a counter value.");
return 0;
}
@@ -828,7 +828,7 @@ Counter* CSSPrimitiveValue::getCounterValue(ExceptionState& exceptionState) cons
Rect* CSSPrimitiveValue::getRectValue(ExceptionState& exceptionState) const
{
if (m_primitiveUnitType != CSS_RECT) {
- exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessError);
+ exceptionState.throwDOMException(InvalidAccessError, "This object is not a rect value.");
return 0;
}
@@ -838,7 +838,7 @@ Rect* CSSPrimitiveValue::getRectValue(ExceptionState& exceptionState) const
Quad* CSSPrimitiveValue::getQuadValue(ExceptionState& exceptionState) const
{
if (m_primitiveUnitType != CSS_QUAD) {
- exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessError);
+ exceptionState.throwDOMException(InvalidAccessError, "This object is not a quad value.");
return 0;
}
@@ -848,7 +848,7 @@ Quad* CSSPrimitiveValue::getQuadValue(ExceptionState& exceptionState) const
PassRefPtr<RGBColor> CSSPrimitiveValue::getRGBColorValue(ExceptionState& exceptionState) const
{
if (m_primitiveUnitType != CSS_RGBCOLOR) {
- exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessError);
+ exceptionState.throwDOMException(InvalidAccessError, "This object is not an RGB color value.");
return 0;
}
@@ -859,7 +859,7 @@ PassRefPtr<RGBColor> CSSPrimitiveValue::getRGBColorValue(ExceptionState& excepti
Pair* CSSPrimitiveValue::getPairValue(ExceptionState& exceptionState) const
{
if (m_primitiveUnitType != CSS_PAIR) {
- exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessError);
+ exceptionState.throwDOMException(InvalidAccessError, "This object is not a pair value.");
return 0;
}
« no previous file with comments | « Source/core/css/CSSMatrix.cpp ('k') | Source/core/css/CSSStyleSheet.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698