-
Notifications
You must be signed in to change notification settings - Fork 443
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
Erlang error improvements #1960
Conversation
filmor
commented
Jun 6, 2023
- Convert Erlang tokenizer/parser errors to SyntaxError, format exceptions
- Raise TokenMissingError for incomplete input
- Use the same snippet code as Elixir does
Uffizzi Preview |
117f092
to
dab72da
Compare
lib/livebook/runtime/evaluator.ex
Outdated
SyntaxError.exception( | ||
file: env.file, | ||
line: :erl_anno.line(location), | ||
column: | ||
case :erl_anno.column(location) do | ||
:undefined -> 1 | ||
val -> val | ||
end, | ||
description: description, | ||
snippet: make_snippet(code, location) | ||
) |
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 think we should encapsulate this in a function? Something like syntax_error(SyntaxError, description, code, location, env)
? Then we can reuse it from different places. :)
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.
Check the latest commit, like that?
Looks great! Ideally we would show them as Erlang errors (as in the Erlang shell) but I think this is a great first step. :) |
@filmor awesome, can you also add an evaluator test for those errors? :) |
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.
Thank you!!