Created
January 6, 2022 08:38
-
-
Save maxpoletaev/51de49e36732606e8877d55a67409559 to your computer and use it in GitHub Desktop.
This file contains 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 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