From a1fbdc2ebea32d3dab258014681e63b8e3af09d9 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sun, 3 Nov 2024 15:51:59 +0100 Subject: [PATCH] Bugfix/exception handling in user authorization (#4015) * Add guard * Update changelog --- CHANGELOG.md | 6 ++++++ apps/api/src/app/auth/jwt.strategy.ts | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5fff96a3e..f675e03df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased + +### Fixed + +- Improved the exception handling in the user authorization service + ## 2.121.1 - 2024-11-02 ### Added diff --git a/apps/api/src/app/auth/jwt.strategy.ts b/apps/api/src/app/auth/jwt.strategy.ts index 1200ed465..7a3fb224b 100644 --- a/apps/api/src/app/auth/jwt.strategy.ts +++ b/apps/api/src/app/auth/jwt.strategy.ts @@ -60,7 +60,7 @@ export class JwtStrategy extends PassportStrategy(Strategy, 'jwt') { ); } } catch (error) { - if (error?.getStatus() === StatusCodes.TOO_MANY_REQUESTS) { + if (error?.getStatus?.() === StatusCodes.TOO_MANY_REQUESTS) { throw error; } else { throw new HttpException(