Skip to content

Instantly share code, notes, and snippets.

@maxpoletaev
Created January 6, 2022 08:38
Show Gist options
  • Save maxpoletaev/51de49e36732606e8877d55a67409559 to your computer and use it in GitHub Desktop.
Save maxpoletaev/51de49e36732606e8877d55a67409559 to your computer and use it in GitHub Desktop.
type Error struct {
parent error
msg string
}
func NewError(msg string) *Error {
return &Error{msg: msg}
}
func (err *Error) New(msg string) *Error {
return &Error{
parent: err,
msg: msg,
}
}
func (err *Error) Error() string {
return err.msg
}
func (err *Error) Unwrap() error {
return err.parent
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment