Script Error line number incorrect
AwooOOoo opened this issue · 4 comments
Describe the bug
Wrote a script with a syntactic error in it and the reported line number of the bug was incorrect. I assume the script is pre-pended with additional wrapping before being executed. In my case the error was on line 8, but was reported on line 16.
Write a script and it had a bug (extra quotes " in a notifications.info statement), but the reported line number was incorrect.
To Reproduce
Steps to reproduce the behavior:
- Write a script with a syntactic error (extra quotes " in a notifications.info statement)
- Execute script
- See error
Expected behavior
Error numbers to be reported to represent the line number of the script. this might become confusing with large scripts. Also having line numbers on the left hand side of the editor would be useful once these numbers are correct.
Desktop (please complete the following information):
- OS: Ubuntu 20.04
- Browser: Chrome
- Version: 84.0.4147.125 (Official Build) (64-bit)
Oooh, that's a tough one to fix! Perhaps if the error was reported along with a full copy of the appended script?
Ì figured it would be, but thought I'd report.
Here is a minimalistic example that exhibits the issue. Notice there is only 4 lines.
function start() {
notifications.alert("Hello world"")
return SUCCESS
}
Here is the reported notification, which fails on line 9.
Script job 'Hello World' permanently failed: :9:37 Missing close quote notifications.alert("Hello world"") ^ in at line number 9 at column number 37
I expect the offset is always the same constant (7). I hate this type of hack, but you could filter the errors before they get pushed to the notifier and correct the line number. I expect however as more capabilities are added to the scripting system this constant (7) would change and this issue would reappear.
@all-contributors add @AwooOOoo for bug reports
I've put up a pull request to add @AwooOOoo! 🎉