1
Fork 0
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:
Matthew Holt 2023-07-25 09:41:56 -06:00
parent e041962b66
commit 18c309b5fa
No known key found for this signature in database
GPG key ID: 2A349DD577D586A5

View file

@ -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)
}