Skip to content

Commit a1cdac1

Browse files
committed
Improve error when failing to parse float fractional or exponent
1 parent 6d42d3f commit a1cdac1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ext/json/ext/parser/parser.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,7 +1135,7 @@ static VALUE json_parse_any(JSON_ParserState *state, JSON_ParserConfig *config)
11351135
state->cursor++;
11361136

11371137
if (state->cursor == state->end || !rb_isdigit(*state->cursor)) {
1138-
raise_parse_error("invalid number: %s", state);
1138+
raise_parse_error_at("invalid number: %s", state, start);
11391139
}
11401140

11411141
while ((state->cursor < state->end) && rb_isdigit(*state->cursor)) {
@@ -1157,7 +1157,7 @@ static VALUE json_parse_any(JSON_ParserState *state, JSON_ParserConfig *config)
11571157
}
11581158

11591159
if (state->cursor == state->end || !rb_isdigit(*state->cursor)) {
1160-
raise_parse_error("invalid number: %s", state);
1160+
raise_parse_error_at("invalid number: %s", state, start);
11611161
}
11621162

11631163
while ((state->cursor < state->end) && rb_isdigit(*state->cursor)) {

0 commit comments

Comments
 (0)