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

Unified Diff: Source/modules/encoding/TextEncoder.cpp

Issue 120063002: Improve modules' TypeError exception messages. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years 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/modules/encoding/TextDecoder.cpp ('k') | Source/modules/imagebitmap/ImageBitmapFactories.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/encoding/TextEncoder.cpp
diff --git a/Source/modules/encoding/TextEncoder.cpp b/Source/modules/encoding/TextEncoder.cpp
index 98b935497dc8cdfac456095abfc0044f015937e6..2ede043797c32167a94e199561d264b373e20b94 100644
--- a/Source/modules/encoding/TextEncoder.cpp
+++ b/Source/modules/encoding/TextEncoder.cpp
@@ -45,13 +45,13 @@ PassRefPtr<TextEncoder> TextEncoder::create(const String& utfLabel, ExceptionSta
WTF::TextEncoding encoding(encodingLabel);
if (!encoding.isValid()) {
- exceptionState.throwUninformativeAndGenericTypeError();
+ exceptionState.throwTypeError("The encoding label provided ('" + encodingLabel + "') is invalid.");
return 0;
}
String name(encoding.name());
if (name != "UTF-8" && name != "UTF-16LE" && name != "UTF-16BE") {
- exceptionState.throwUninformativeAndGenericTypeError();
+ exceptionState.throwTypeError("The encoding label provided ('" + encodingLabel + "') is not one of 'UTF-8', 'UTF-16LE', or 'UTF-16BE'.");
jsbell 2013/12/20 17:47:50 Nit: Lots of labels aliases for these are accepted
jsbell 2013/12/20 17:51:08 And maybe "encoding provided" instead of "encoding
return 0;
}
« no previous file with comments | « Source/modules/encoding/TextDecoder.cpp ('k') | Source/modules/imagebitmap/ImageBitmapFactories.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698