From 2a85bbb480627a74012bebc82c0724d953a31290 Mon Sep 17 00:00:00 2001 From: Rein Krul Date: Thu, 2 Jul 2026 13:17:11 +0200 Subject: [PATCH] fix: unwrap error chain when resolving HTTP status code GetHTTPStatusCode only did a direct type assertion for HTTPStatusCodeError, so any fmt.Errorf("...: %w", err) wrap between an error's origin and the Echo error handler silently discarded a deliberately-set status code, falling back to 500. This affected RequestServiceAccessToken when the remote presentation definition endpoint returns an OAuth2 error (e.g. invalid_scope), among other paths, per #2943. --- core/echo_errors.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/echo_errors.go b/core/echo_errors.go index 6eb8a25f7d..39dde1ff3c 100644 --- a/core/echo_errors.go +++ b/core/echo_errors.go @@ -193,7 +193,7 @@ func ResolveStatusCode(err error, mapping map[error]int) int { // - from handler // - if none of the above criteria match, HTTP 500 Internal Server Error is returned. func GetHTTPStatusCode(err error, ctx echo.Context) int { - if predefined, ok := err.(HTTPStatusCodeError); ok { + if predefined, ok := errors.AsType[HTTPStatusCodeError](err); ok { return predefined.StatusCode() } if predefined, ok := err.(*echo.HTTPError); ok {