|
|
@ -28,14 +28,25 @@ type Error struct { |
|
|
|
Err error |
|
|
|
Err error |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (err Error) prefix() string { |
|
|
|
|
|
|
|
switch { |
|
|
|
|
|
|
|
case err.Line > 0 || err.Column > 0: |
|
|
|
|
|
|
|
if err.Filename != "" { |
|
|
|
|
|
|
|
return fmt.Sprintf("%s:%v:%v", err.Filename, err.Line, err.Column) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return fmt.Sprintf("%v:%v", err.Line, err.Column) |
|
|
|
|
|
|
|
default: |
|
|
|
|
|
|
|
return err.Filename |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func (err Error) Error() string { |
|
|
|
func (err Error) Error() string { |
|
|
|
var s []string |
|
|
|
var s []string |
|
|
|
|
|
|
|
|
|
|
|
switch { |
|
|
|
prefix := err.prefix() |
|
|
|
case err.Line > 0 || err.Column > 0: |
|
|
|
if prefix != "" { |
|
|
|
s = append(s, fmt.Sprintf("%s:%v:%v", err.Filename, err.Line, err.Column)) |
|
|
|
s = append(s, prefix) |
|
|
|
case err.Filename != "": |
|
|
|
|
|
|
|
s = append(s, err.Filename) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if err.Err != nil { |
|
|
|
if err.Err != nil { |
|
|
|