mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-26 21:53:48 +03:00
caddyhttp: Preserve original error (fix #5652)
This commit is contained in:
parent
e041962b66
commit
18c309b5fa
1 changed files with 3 additions and 1 deletions
|
@ -15,6 +15,7 @@
|
||||||
package caddyhttp
|
package caddyhttp
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
weakrand "math/rand"
|
weakrand "math/rand"
|
||||||
"path"
|
"path"
|
||||||
|
@ -30,7 +31,8 @@ import (
|
||||||
// set will be populated.
|
// set will be populated.
|
||||||
func Error(statusCode int, err error) HandlerError {
|
func Error(statusCode int, err error) HandlerError {
|
||||||
const idLen = 9
|
const idLen = 9
|
||||||
if he, ok := err.(HandlerError); ok {
|
var he HandlerError
|
||||||
|
if errors.As(err, &he) {
|
||||||
if he.ID == "" {
|
if he.ID == "" {
|
||||||
he.ID = randString(idLen, true)
|
he.ID = randString(idLen, true)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue