Commit 83ca0fd9 authored by Mason Freed's avatar Mason Freed Committed by Commit Bot

Clarify range error message by removing regular expression details

Prior to this CL, out of range floating point numbers gave a confusing
error message with details about the regex being used:
 The specified value "1.79E+309" is not a valid number. The value must
 match to the following regular expression:
  -?(\d+|\d+\.\d+|\.\d+)([eE][-+]?\d+)?

Now they just give this error:
 The specified value "1.79E+309" cannot be parsed, or is out of range.

Fixed: 785972
Change-Id: I7eaa56d170317d7387c0a096956a96d0f68099d9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2010064
Commit-Queue: Mason Freed <masonfreed@chromium.org>
Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Auto-Submit: Mason Freed <masonfreed@chromium.org>
Cr-Commit-Position: refs/heads/master@{#734085}
parent df5f81c3
......@@ -246,10 +246,7 @@ void NumberInputType::WarnIfValueIsInvalid(const String& value) const {
if (value.IsEmpty() || !GetElement().SanitizeValue(value).IsEmpty())
return;
AddWarningToConsole(
"The specified value %s is not a valid number. The value must match to "
"the following regular expression: "
"-?(\\d+|\\d+\\.\\d+|\\.\\d+)([eE][-+]?\\d+)?",
value);
"The specified value %s cannot be parsed, or is out of range.", value);
}
bool NumberInputType::HasBadInput() const {
......
......@@ -314,10 +314,7 @@ void RangeInputType::WarnIfValueIsInvalid(const String& value) const {
if (value.IsEmpty() || !GetElement().SanitizeValue(value).IsEmpty())
return;
AddWarningToConsole(
"The specified value %s is not a valid number. The value must match to "
"the following regular expression: "
"-?(\\d+|\\d+\\.\\d+|\\.\\d+)([eE][-+]?\\d+)?",
value);
"The specified value %s cannot be parsed, or is out of range.", value);
}
void RangeInputType::DisabledAttributeChanged() {
......
CONSOLE WARNING: line 5: The specified value "ABC" is not a valid number. The value must match to the following regular expression: -?(\d+|\d+\.\d+|\.\d+)([eE][-+]?\d+)?
CONSOLE WARNING: line 5: The specified value "ABC" cannot be parsed, or is out of range.
Tests that invalid values are considered in-range.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
......
CONSOLE WARNING: line 24: The specified value "foo" is not a valid number. The value must match to the following regular expression: -?(\d+|\d+\.\d+|\.\d+)([eE][-+]?\d+)?
CONSOLE WARNING: line 24: The specified value "foo" is not a valid number. The value must match to the following regular expression: -?(\d+|\d+\.\d+|\.\d+)([eE][-+]?\d+)?
CONSOLE WARNING: line 24: The specified value "foo" is not a valid number. The value must match to the following regular expression: -?(\d+|\d+\.\d+|\.\d+)([eE][-+]?\d+)?
CONSOLE WARNING: line 24: The specified value "foo" is not a valid number. The value must match to the following regular expression: -?(\d+|\d+\.\d+|\.\d+)([eE][-+]?\d+)?
CONSOLE WARNING: line 24: The specified value "foo" is not a valid number. The value must match to the following regular expression: -?(\d+|\d+\.\d+|\.\d+)([eE][-+]?\d+)?
CONSOLE WARNING: line 24: The specified value "foo" is not a valid number. The value must match to the following regular expression: -?(\d+|\d+\.\d+|\.\d+)([eE][-+]?\d+)?
CONSOLE WARNING: line 24: The specified value "foo" cannot be parsed, or is out of range.
CONSOLE WARNING: line 24: The specified value "foo" cannot be parsed, or is out of range.
CONSOLE WARNING: line 24: The specified value "foo" cannot be parsed, or is out of range.
CONSOLE WARNING: line 24: The specified value "foo" cannot be parsed, or is out of range.
CONSOLE WARNING: line 24: The specified value "foo" cannot be parsed, or is out of range.
CONSOLE WARNING: line 24: The specified value "foo" cannot be parsed, or is out of range.
Check stepping-up and -down for number input from renderer.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment