d2/d2ast/error.go
Alexander Wang 524c089a74 oss
Co-authored-by: Anmol Sethi <hi@nhooyr.io>
2022-11-03 06:54:49 -07:00

15 lines
532 B
Go

package d2ast
// TODO: Right now this is here to be available in both the Parser and Compiler but
// eventually we should make this a real part of the AST so that autofmt works on
// files with parse errors and semantically it makes more sense.
// Compile would continue to maintain a separate set of errors and then we'd do a
// merge & sort to get the final list of errors for user display.
type Error struct {
Range Range `json:"range"`
Message string `json:"errmsg"`
}
func (e Error) Error() string {
return e.Message
}