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

Improve syntax and runtime error messages #60

Open
3 tasks
ckski opened this issue Nov 4, 2020 · 1 comment
Open
3 tasks

Improve syntax and runtime error messages #60

ckski opened this issue Nov 4, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@ckski
Copy link
Contributor

ckski commented Nov 4, 2020

Currently the following code:

%%ignite

if True:
    pass
else False:
    pass

Results in the following error:
Error: invalid syntax (<string>, line 4)

This is confusing because the error is actually on line 5 (%%ignite does not get counted).
Ideally we want this to be similar to full python error message which shows the position of the syntax error also.

 File "<stdin>", line 3
    else False:
         ^
SyntaxError: invalid syntax

Acceptance:

  • Syntax error message shows correct line number (1 line after started #)
  • Syntax error message shows the position of where the syntax error starts
  • unit test(s)

See comments for advice

@ckski ckski added the enhancement New feature or request label Nov 4, 2020
@ckski
Copy link
Contributor Author

ckski commented Nov 18, 2020

A suggestion for implementing this is to use traceback.format_exc() which returns a string with the exception formatted. The file name can be removed and the line number must be incremented by one.

@AlphaRLee AlphaRLee changed the title Improve syntax error messages Improve syntax and runtime error messages Nov 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant