|
|
|
|
|
by ericbb
5209 days ago
|
|
The error type is an interface. You can return values that contain contextual information as long as the error value you return has an Error() method returning a string. type ParseError struct {
line int
}
func (e ParseError) Error() string {
return "Parse error at line: " + fmt.Sprint(e.line)
}
Note: The current release may vary slightly on the details. I'm using a pre-release build. But older versions are similar. |
|