-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #143 #144
Fix #143 #144
Conversation
Nice, thanks for digging into it! |
Note that this means that ParseException: expected json value got '}...' (line 1, column 1) …instead of the current: ParseException: expected json value got '}x' (line 1, column 1) …which seems reasonable to me, but we could alternatively fix this by making sure |
Some more things that return
This fix works, but maybe it's worth exploring that alternative idea with the leaking |
@rossabaker Nice. And agreed. I'm happy to take a stab at it |
Just pushed a fix that makes sure |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like it. Add a @tailrec
if both you and scalac find it agreeable, but 👍 either way.
if (j <= i) "" else { | ||
try at(i, j) catch { | ||
case _: Exception => | ||
safeAt(i, j - 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
j-i
is at most ErrorContext
(which is 6), right? Just wondering about catching and throwing absurd numbers of exceptions as it walks back, but I won't lose sleep over up to 6. And I think it's @tailrec
, though I didn't ask scalac.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In theory you could pass some ridiculously large context to die
, but it's protected, so I'm not too worried about that. Also except in the (kind of weird) AsyncParser
usage the at
call in safeAt
will never throw exceptions at all, since atEof
has been checked.
(It is @tailrec
, by the way, so I went ahead and added it.)
This is a funny one. The problem is that the new error message stuff from #129 calls
at(i, j)
with out-of-bounds arguments onAsyncParser
, which throws anAsyncException
instead of aParseException
, which means theabsorb
call isn't treated as a failure.My feeling is that we're going to keep seeing problems introduced by #129 for a while, starting with #142, which I'm hoping to get to next.
r? @BenFradet @non