Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 13, 00:30 UTC
caddyhttp: Preserve original error (fix #5652)
Matthew Holt committed
Jul 25, 2023 at 09:41 UTC
18c309b5fa1847a5303a053a4c79d3a395bdd823
1 file changed
+3
-1
modules/caddyhttp/errors.go
+3
-1
@@ -15,6 +15,7 @@
15
package caddyhttp
16
17
import (
18
+ "errors"
19
"fmt"
20
weakrand "math/rand"
21
"path"
@@ -30,7 +31,8 @@ import (
31
// set will be populated.
32
func Error(statusCode int, err error) HandlerError {
33
const idLen = 9
33
- if he, ok := err.(HandlerError); ok {
34
+ var he HandlerError
35
+ if errors.As(err, &he) {
36
if he.ID == "" {
37
he.ID = randString(idLen, true)
38
}