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

Error reporting issues #190

Closed
danyaPostfactum opened this issue Apr 14, 2014 · 4 comments
Closed

Error reporting issues #190

danyaPostfactum opened this issue Apr 14, 2014 · 4 comments

Comments

@danyaPostfactum
Copy link

Go https://rawgit.com/danyaPostfactum/ace/python-worker/kitchen-sink.html and select python document.

Paste the code:

def fn():

You will not see a error because Skulpt provides wrong lineno (last + 1 line)

Paste the code:

    1

Skulpt will produce bad input error, but it should produce unexpected indent IndentationError

Skulpt throws ParseError, but it should be SyntaxError.

I didn't find an easy way to get an error message. Currently it' stored into a v property.

@bnmnetp
Copy link
Contributor

bnmnetp commented Apr 14, 2014

There is nothing wrong with a single line def fn():

Python can not determine that the function definition statement is in error until you have an unindented line with no function body.

@rixner
Copy link
Contributor

rixner commented Apr 14, 2014

The line number that Skulpt gives for the "def fn():" example is correct, as described by Brad. This is the same thing CPython does.

However, I agree that the types of exceptions that get thrown in both cases do not match CPython. Exactly matching the particular error of a bad program that doesn't even compile has not been our highest priority, though.

All exception objects have a "toString()" method which will give you the formatted error message.

@danyaPostfactum
Copy link
Author

Indeed. I was baffled by SublimeLinter. It shows "unexpected EOF while parsing" on line 1.
But standalone python (2.7) produces IndentationError on line 2 (that is very strange, because line 2 does not exist :) ).

I don't know why do they behave differently. Maybe SublimeLinter preprocesses results. Or maybe this is because of interpreter version difference.

First line of toString() result looks good, thanks.

@albertjan
Copy link
Member

I believe this can be closed aswel.

@bnmnetp bnmnetp closed this as completed May 12, 2014
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

No branches or pull requests

4 participants