Skip to content
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

Merged
merged 7 commits into from
Jun 6, 2023
Merged

Conversation

filmor
Copy link
Contributor

@filmor 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

@github-actions
Copy link

github-actions bot commented Jun 6, 2023

Uffizzi Preview deployment-27676 was deleted.

@filmor filmor force-pushed the erlang-errors branch 2 times, most recently from 117f092 to dab72da Compare June 6, 2023 07:11
Comment on lines 771 to 781
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)
)
Copy link
Contributor

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. :)

Copy link
Contributor Author

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?

@josevalim
Copy link
Contributor

Looks great! Ideally we would show them as Erlang errors (as in the Erlang shell) but I think this is a great first step. :)

@jonatanklosko
Copy link
Member

@filmor awesome, can you also add an evaluator test for those errors? :)

Copy link
Member

@jonatanklosko jonatanklosko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!!

@jonatanklosko jonatanklosko merged commit 377b677 into livebook-dev:main Jun 6, 2023
@filmor filmor deleted the erlang-errors branch June 6, 2023 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants