Skip to content

Commit

Permalink
Merge pull request #58 from quinnj/jq/invalidnum
Browse files Browse the repository at this point in the history
Throw a more informative error on invalid numbers. Fixes #57.
  • Loading branch information
quinnj authored May 6, 2020
2 parents 23cd511 + 7b68091 commit 304ae9f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/JSON3.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ invalid JSON at byte position $pos while parsing type $T: $error
$(String(buf[max(1, pos-25):min(end, pos+25)]))
"""))

@enum Error UnexpectedEOF ExpectedOpeningObjectChar ExpectedOpeningQuoteChar ExpectedOpeningArrayChar ExpectedClosingArrayChar ExpectedComma ExpectedSemiColon InvalidChar
@enum Error UnexpectedEOF ExpectedOpeningObjectChar ExpectedOpeningQuoteChar ExpectedOpeningArrayChar ExpectedClosingArrayChar ExpectedComma ExpectedSemiColon InvalidChar InvalidNumber

# AbstractDict interface
function Base.length(obj::Object)
Expand Down
1 change: 1 addition & 0 deletions src/read.jl
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ function read!(buf, pos, len, b, tape, tapeidx, ::Type{Any}, checkint=true)
end
return floatpos, tapeidx + 2
end
invalid(InvalidNumber, buf, pos, Float64)
end
@label invalid
invalid(InvalidChar, buf, pos, Any)
Expand Down

0 comments on commit 304ae9f

Please sign in to comment.