canonical / sqlair

Friendly type mapping for SQL databases
Apache License 2.0
16 stars 8 forks source link

Add line numbers and columns to error messages #108

Closed letFunny closed 9 months ago

letFunny commented 9 months ago

Add line number and columns to errors taking into account the line breaks in the input. Also, added missing tests to get full coverage of the parser errors. Lastly, change column calculations for some errors, examples below (B: before, A: after):

letFunny commented 9 months ago

@niemeyer in your suggestion to make the errors clearer, do you mean to omit the line if the input is only one line? or, do you mean to omit the line if it is the first one regardless of the total number of lines of the input?

I think the former makes the error clearer, although in the code we would need to look for newlines in the rest of the input to see that there are none because the parsing error could be reported before encountering the first one.