Skip to content

Commit

Permalink
Improve error message
Browse files Browse the repository at this point in the history
  • Loading branch information
ohler55 committed Jun 7, 2020
1 parent 0c31f9d commit 14f9770
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions ext/oj/parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -848,6 +848,12 @@ oj_set_error_at(ParseInfo pi, VALUE err_clas, const char* file, int line, const
if (p + 3 < end) {
*p++ = ' ';
*p++ = '(';
*p++ = 'a';
*p++ = 'f';
*p++ = 't';
*p++ = 'e';
*p++ = 'r';
*p++ = ' ';
start = p;
for (vp = pi->stack.head; vp < pi->stack.tail; vp++) {
if (end <= p + 1 + vp->klen) {
Expand Down
2 changes: 1 addition & 1 deletion test/sample_obj.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
{
"attr1": 12345,
"attr2": "a string",
"attr3/Time": 1234567.7777
"attr3/Time": 1234567.7777,
"attr4/Foo::Bar": {
"a": "xyz"
}
Expand Down
2 changes: 1 addition & 1 deletion test/test_various.rb
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ def test_error_path
raise e
end
}
assert_equal('first[2].third', msg.split('(')[1].split(')')[0])
assert_equal('after first[2].third', msg.split('(')[1].split(')')[0])
end

def test_bad_bignum
Expand Down

0 comments on commit 14f9770

Please sign in to comment.