Created
February 11, 2018 14:56
-
-
Save tomtsang/2b7ac04a31a56e4071e231c49df96e76 to your computer and use it in GitHub Desktop.
error-type.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type SyntaxError struct { | |
msg string // description of error | |
// error occurred after reading Offset bytes, from which line and columnnr can be obtained | |
Offset int64 | |
} | |
func (e *SyntaxError) String() string { return e.msg } | |
if serr, ok := err.(*json.SyntaxError); ok { | |
line, col := findLine(f, serr.Offset) | |
return fmt.Errorf("%s:%d:%d: %v", f.Name(), line, col, err) | |
} | |
package net | |
type Error interface { | |
Timeout() bool // Is the error a timeout? | |
Temporary() bool // Is the error temporary? | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment