summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorroubert@google.com <roubert@google.com@ee073f10-1060-11df-b6a4-87a95322a99c>2012-11-06 16:14:28 +0000
committerroubert@google.com <roubert@google.com@ee073f10-1060-11df-b6a4-87a95322a99c>2012-11-06 16:14:28 +0000
commit7962795a5e2f7d83fa7793c833b86b3a9b02bdbb (patch)
treefca907e93db3b45180a54ed850d9f6d9e6656b9b
parente67fcaea2f357803bd7763fb3e4a4ea268c23358 (diff)
downloadandroid_external_libphonenumbergoogle-7962795a5e2f7d83fa7793c833b86b3a9b02bdbb.tar.gz
android_external_libphonenumbergoogle-7962795a5e2f7d83fa7793c833b86b3a9b02bdbb.tar.bz2
android_external_libphonenumbergoogle-7962795a5e2f7d83fa7793c833b86b3a9b02bdbb.zip
JS: Replace hardcoded exception string with proper enum value, as declared.
Review URL: https://codereview.appspot.com/6814093 git-svn-id: http://libphonenumber.googlecode.com/svn/trunk@539 ee073f10-1060-11df-b6a4-87a95322a99c
-rw-r--r--javascript/i18n/phonenumbers/phonenumberutil.js2
-rw-r--r--javascript/i18n/phonenumbers/phonenumberutil_test.js4
2 files changed, 3 insertions, 3 deletions
diff --git a/javascript/i18n/phonenumbers/phonenumberutil.js b/javascript/i18n/phonenumbers/phonenumberutil.js
index a73e3c1..28fdee2 100644
--- a/javascript/i18n/phonenumbers/phonenumberutil.js
+++ b/javascript/i18n/phonenumbers/phonenumberutil.js
@@ -3628,7 +3628,7 @@ i18n.phonenumbers.PhoneNumberUtil.prototype.parseHelper_ =
throw i18n.phonenumbers.Error.NOT_A_NUMBER;
} else if (numberToParse.length >
i18n.phonenumbers.PhoneNumberUtil.MAX_INPUT_STRING_LENGTH_) {
- throw 'The string supplied was too long to parse';
+ throw i18n.phonenumbers.Error.TOO_LONG;
}
/** @type {!goog.string.StringBuffer} */
diff --git a/javascript/i18n/phonenumbers/phonenumberutil_test.js b/javascript/i18n/phonenumbers/phonenumberutil_test.js
index 62359e4..83a86f6 100644
--- a/javascript/i18n/phonenumbers/phonenumberutil_test.js
+++ b/javascript/i18n/phonenumbers/phonenumberutil_test.js
@@ -2210,7 +2210,7 @@ function testParseMaliciousInput() {
} catch (e) {
// Expected this exception.
assertEquals('Wrong error type stored in exception.',
- 'The string supplied was too long to parse',
+ i18n.phonenumbers.Error.TOO_LONG,
e);
}
/** @type {!goog.string.StringBuffer} */
@@ -2226,7 +2226,7 @@ function testParseMaliciousInput() {
} catch (e) {
// Expected this exception.
assertEquals('Wrong error type stored in exception.',
- 'The string supplied was too long to parse',
+ i18n.phonenumbers.Error.TOO_LONG,
e);
}
}