diff --git a/javascript/i18n/phonenumbers/phonenumberutil.js b/javascript/i18n/phonenumbers/phonenumberutil.js index a73e3c1ea..28fdee251 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 62359e416..83a86f64f 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); } }