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

Incorrect line numbers in error messsages #2334

Closed
emlyn opened this issue Apr 12, 2020 · 12 comments
Closed

Incorrect line numbers in error messsages #2334

emlyn opened this issue Apr 12, 2020 · 12 comments
Assignees

Comments

@emlyn
Copy link
Contributor

emlyn commented Apr 12, 2020

I've noticed that the error messages often have the line number (and marker) off by one:
image

If the error is on the first line, then the line number and marker are omitted:
image

And for some errors, the line number is completely off:
image

@ethancrawford
Copy link
Collaborator

@emlyn - which version of Sonic Pi?

@emlyn
Copy link
Contributor Author

emlyn commented Apr 12, 2020

@ethancrawford this was in 3.2.2, though I think it's been there for a couple of versions at least.

You can see it also in some forum posts, such as here.

@samaaron
Copy link
Collaborator

I've noticed this a couple of times too. I haven't spent the time to figure it out. I will eventually unless some on here beats me to it.

@ethancrawford
Copy link
Collaborator

ethancrawford commented Apr 12, 2020

I've been contemplating investigating/creating a fix of some kind for a similar issue for a while - see #2336.

@ethancrawford
Copy link
Collaborator

Not to mention that in some of the above cases, the error is reported as coming from 'buffer X' and in others, 'workspace_X' - this would be good to address at the same time if possible!

@ethancrawford
Copy link
Collaborator

Looking at the last of the above screenshots, it appears that the SyntaxError there is reported in a similar fashion to what happens with external files, as described in my linked issue above - the original line triggering the error is from runtime.rb line 781. So at first glance it would seem related to it.

@rbnpi
Copy link
Contributor

rbnpi commented Apr 12, 2020

Yes I agree. Cetainly recently (in 3.2.2) I have noticed that the error line number is one too few. Also if the error is a mssing end statement it gives the error line 781 (presumably the max size of the buffer) even though it doesn't exist.

@ethancrawford
Copy link
Collaborator

@rbnpi - see my above comment - I suspect that errors not triggered from code directly in a buffer are what those line numbers such as 781 refer to...

@ethancrawford
Copy link
Collaborator

I'm currently working on the line 781 version of the above error message.

@ethancrawford
Copy link
Collaborator

So I believe the syntax error case seen in the last of the above screenshots is at least partly caused by 80dcdce
as the exception handling specific to syntax errors has been skipped from then on (note that they were supposed to be displayed in a different colour etc). I'm attempting to fix this.

@ethancrawford
Copy link
Collaborator

I'm close to having a PR ready for both the instances raised in this issue as well as #2336 🥳

@ethancrawford ethancrawford self-assigned this Apr 23, 2020
@samaaron
Copy link
Collaborator

This has been fixed on the main branch here : 1746ddc

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