Enrich error messages information where the error occurred.
What I want
Error messages do not show anything where the error has occurred.
Error messages should include information where the error has happened.
- Path to file in which the error occurred.
- The number of the line where the error was raised.
- The column at the char position in the line where the error starts.
I think printing out the absolute path of the file is most reliable and help with locating the error the best. If the command was executed with option "-c" then the path should be a keyword like "literal command". Because paths can become long I propose that the ion errors should have 2 lines.
First Line shows the error kind and the file path. Second line shows a tuple (line_number:column) and then the error description.
Purpose
It would aid when debugging scripts. Especially in more complex scripts this can make life easier.
Example with a file which is named "some_file"
echo "Print out not declared variable 'ab' "
echo $ab
Print out not declared variable 'ab' Desired output:
Print out not declared variable 'ab'
ion: expansion error at (path_to_file):
ion: (2:5) Variable does not exist
Instead of current output:
Print out not declared variable 'ab'
ion: expansion error: Variable does not exist
Example with inline command via option "-c"
ion -c "echo $does_not_exits"
Desired output:
ion: expansion error in literal command:
ion: (1:6)