diff options
author | Ryo Nihei <nihei.dev@gmail.com> | 2021-07-18 22:15:35 +0900 |
---|---|---|
committer | Ryo Nihei <nihei.dev@gmail.com> | 2021-07-18 22:15:35 +0900 |
commit | e4a5958fc8d9e131ab083215a51a1b60acf91410 (patch) | |
tree | 6ca224a42915135e8f5427d62fc52455b1a1bc59 /error/error.go | |
parent | Add token positions to an AST (diff) | |
download | cotia-e4a5958fc8d9e131ab083215a51a1b60acf91410.tar.gz cotia-e4a5958fc8d9e131ab083215a51a1b60acf91410.tar.xz |
Detect multiple semantic errors in a single parse
Diffstat (limited to 'error/error.go')
-rw-r--r-- | error/error.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/error/error.go b/error/error.go index 1e5df7a..f953e3b 100644 --- a/error/error.go +++ b/error/error.go @@ -25,6 +25,7 @@ func (e SpecErrors) Error() string { type SpecError struct { Cause error + Detail string FilePath string SourceName string Row int @@ -39,6 +40,9 @@ func (e *SpecError) Error() string { fmt.Fprintf(&b, "%v: ", e.Row) } fmt.Fprintf(&b, "error: %v", e.Cause) + if e.Detail != "" { + fmt.Fprintf(&b, ": %v", e.Detail) + } line := readLine(e.FilePath, e.Row) if line != "" { |