feat: add typed error message templates and stable replay snapshots
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"runtime/debug"
|
||||
"time"
|
||||
@@ -93,6 +94,10 @@ func AccessLog(options ...AccessLogOption) httpx.Middleware {
|
||||
}
|
||||
if failure != nil {
|
||||
attrs = append(attrs, "failed", true, "errorKey", failure.Code)
|
||||
var parameterErr *apierrors.ParamError
|
||||
if errors.As(failure, ¶meterErr) {
|
||||
attrs = append(attrs, "errorParameter", parameterErr.Error())
|
||||
}
|
||||
if failure.BusinessCode != nil {
|
||||
attrs = append(attrs, "businessCode", failure.BusinessCode)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user