Browse Source

JS: Replace hardcoded exception string with proper enum value, as declared.

Review URL: https://codereview.appspot.com/6814093
pull/567/head
Fredrik Roubert 13 years ago
committed by Mihaela Rosca
parent
commit
2f0bbdba10
2 changed files with 3 additions and 3 deletions
  1. +1
    -1
      javascript/i18n/phonenumbers/phonenumberutil.js
  2. +2
    -2
      javascript/i18n/phonenumbers/phonenumberutil_test.js

+ 1
- 1
javascript/i18n/phonenumbers/phonenumberutil.js View File

@ -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} */


+ 2
- 2
javascript/i18n/phonenumbers/phonenumberutil_test.js View File

@ -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);
}
}


Loading…
Cancel
Save