-
Notifications
You must be signed in to change notification settings - Fork 53
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
Structured parse errors #489
Comments
Yeah, the error reporting is really old. I'm in favor of exposing this information. Perhaps something like this: package idl
type ParseError struct{ Lines []LineError }
type LineError struct {
Line int
Err error
} It's been a while, but looking at lex.rl, what this will take modifying the following: thriftrw-go/idl/internal/lex.rl Line 346 in fe65efe
To something like this:
And updating all the call sites to it: -lex.Error(err.Error())
+lex.AppendError(err) If we define ParseError and LineError in |
Previously, parse errors (`idl.internal.parseError`) weren't visible to `idl.Parse()`'s callers. This was inconvenient because it's useful to have access to (a) the full list of parse errors and (b) the line number that caused each parse error. This change introduces `idl.ParseError` which provides a list of errors and their lines. Fixes #489
Previously, parse errors (`idl.internal.parseError`) weren't visible to `idl.Parse()`'s callers. This was inconvenient because it's useful to have access to (a) the full list of parse errors and (b) the line number that caused each parse error. This change introduces `idl.ParseError` which provides a list of errors and their lines. Fixes #489
idl.Parse()
errors are always of the un-exported typeidl.internal.parseError
, which wraps a map of per-line parse error messages.It would be useful to expose these per-line error messages to the caller in a structured way. Otherwise, the only visibility callers have into parse errors is the multiline string provided by
parseError.Error()
:The text was updated successfully, but these errors were encountered: