Created
November 1, 2017 05:35
-
-
Save travisjeffery/3aae285aa8afa5e01fa3b9f91ef64763 to your computer and use it in GitHub Desktop.
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
// error.go | |
// assert Error implements the error interface. | |
var _ error = &Error{} | |
// Error implements the error interface. | |
func (e *Error) Error() string { | |
b := new(bytes.Buffer) | |
e.printStack(b) | |
pad(b, ": ") | |
b.WriteString(e.Message) | |
if b.Len() == 0 { | |
return "no error" | |
} | |
return b.String() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
what is it for?