mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-15 08:23:34 +01: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
fe77d661b3
commit
81e3d4305f
@ -455,6 +455,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 New Issue
Block a user