Description
The 'Error' type defined in errors.go does not implement ".Unwrap() error", which prevents the usage of "errors.Is()" and "errors.As()"
How to reproduce
package main
import (
"github.com/gin-gonic/gin"
)
type TestStrErr string
func (e TestStrErr) Error() string { return string(e) }
func main() {
testErr := TestStrErr("some error")
err := &gin.Error{Err: testErr}
if errors.Is(err, testErr) {
fmt.Println("match with testErr ok")
}
var unwrap TestStrErr
if errors.As(err, &unwrap) {
fmt.Println("succesfully unwrapped as a TestStrErr")
}
}
Expectations
output :
match with testErr ok
succesfully unwrapped as a TestStrErr
Actual result
no output
Environment
- go version: go version go1.14.2 linux/amd64
- gin version (or commit ref): 540b1ef
- operating system: linux
Description
The 'Error' type defined in errors.go does not implement ".Unwrap() error", which prevents the usage of "errors.Is()" and "errors.As()"
How to reproduce
Expectations
output :
Actual result
no output
Environment