mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/httpserver: add Unwrap method to ErrorWithStatusCode, so As
and Is
functions in standard errors
package may properly unwrap the error inside ErrorWithStatusCode
This commit is contained in:
parent
84a37098ed
commit
b277ba8121
1 changed files with 7 additions and 0 deletions
|
@ -506,6 +506,13 @@ type ErrorWithStatusCode struct {
|
|||
StatusCode int
|
||||
}
|
||||
|
||||
// Unwrap returns e.Err.
|
||||
//
|
||||
// This is used by standard errors package. See https://golang.org/pkg/errors
|
||||
func (e *ErrorWithStatusCode) Unwrap() error {
|
||||
return e.Err
|
||||
}
|
||||
|
||||
// Error implements error interface.
|
||||
func (e *ErrorWithStatusCode) Error() string {
|
||||
return e.Err.Error()
|
||||
|
|
Loading…
Reference in a new issue