mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-16 21:56:40 -05: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
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
weakrand "math/rand"
|
||||
"path"
|
||||
|
@ -30,7 +31,8 @@ import (
|
|||
// set will be populated.
|
||||
func Error(statusCode int, err error) HandlerError {
|
||||
const idLen = 9
|
||||
if he, ok := err.(HandlerError); ok {
|
||||
var he HandlerError
|
||||
if errors.As(err, &he) {
|
||||
if he.ID == "" {
|
||||
he.ID = randString(idLen, true)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue