diff --git a/internal/api/auth.go b/internal/api/auth.go index 4e63715a1..d6d079364 100644 --- a/internal/api/auth.go +++ b/internal/api/auth.go @@ -123,7 +123,7 @@ func (a *API) maybeLoadUserOrSession(ctx context.Context) (context.Context, erro session, err = models.FindSessionByID(db, sessionId, false) if err != nil { if models.IsNotFoundError(err) { - return ctx, forbiddenError(ErrorCodeSessionNotFound, "Session from session_id claim in JWT does not exist") + return ctx, forbiddenError(ErrorCodeSessionNotFound, "Session from session_id claim in JWT does not exist").WithInternalError(err).WithInternalMessage(fmt.Sprintf("session id (%s) doesn't exist", sessionId)) } return ctx, err } diff --git a/internal/api/auth_test.go b/internal/api/auth_test.go index 35a64be92..3150628d9 100644 --- a/internal/api/auth_test.go +++ b/internal/api/auth_test.go @@ -167,7 +167,7 @@ func (ts *AuthTestSuite) TestMaybeLoadUserOrSession() { Role: "authenticated", SessionId: "73bf9ee0-9e8c-453b-b484-09cb93e2f341", }, - ExpectedError: forbiddenError(ErrorCodeSessionNotFound, "Session from session_id claim in JWT does not exist"), + ExpectedError: forbiddenError(ErrorCodeSessionNotFound, "Session from session_id claim in JWT does not exist").WithInternalError(models.SessionNotFoundError{}).WithInternalMessage("session id (73bf9ee0-9e8c-453b-b484-09cb93e2f341) doesn't exist"), ExpectedUser: u, ExpectedSession: nil, },