We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents f861e14 + 8cfb3d6 commit 9c4b3adCopy full SHA for 9c4b3ad
1 file changed
http.go
@@ -1,6 +1,9 @@
1
package errorutil
2
3
-import "net/http"
+import (
4
+ "errors"
5
+ "net/http"
6
+)
7
8
// HTTPStatusCodeEr defines errors that should return a specific HTTP status code
9
type HTTPStatusCodeEr interface {
@@ -55,10 +58,11 @@ func HTTPStatusCode(err error) int {
55
58
return http.StatusRequestTimeout
56
59
}
57
60
cause, ok := err.(causer)
- if !ok {
- break
61
+ if ok {
62
+ err = cause.Cause()
63
+ } else {
64
+ err = errors.Unwrap(err)
65
- err = cause.Cause()
66
67
return http.StatusInternalServerError
68
0 commit comments