Include source location info for all user-facing error messages
Outside of internal errors, we should be able to provide source location info (both start and end locations from the Flux program) for any error that we return to the user. (Even for internal errors, source location would be quite useful, e.g, if storage was down the source location info could indicate the call to from() that had the issue)
This would help make error messages much more useful, and also open the door to cool web UI features like being able to highlight problematic parts of Flux text just by hovering over the error message.
We could either indicate the source locations by embedding them in a message, or more programmatically by defining a special struct for Flux errors with fields for source location:
package flux
type interface Error {
Error() string
SourceLocation() *ast.SourceLocation
}
See also #1364
For compilation errors (at least) it would be nice if we could point to the source itself in error messages so you do not have to trace the line/column number manually. https://github.com/brendanzab/codespan handles most of the tricky parts of layout so assuming we are ok with altering the error format a bit it should not be that difficult to add as we have all the information we need already (as far as I can tell).
This issue has had no recent activity and will be closed soon.