From 622f7258963cfb6cc809f7da56e8a2f15b92ab62 Mon Sep 17 00:00:00 2001 From: Gauthier Roebroeck Date: Mon, 28 Jun 2021 14:08:51 +0800 Subject: [PATCH] refactor: incorrect exception thrown --- .../kotlin/org/gotson/komga/interfaces/rest/UserController.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/komga/src/main/kotlin/org/gotson/komga/interfaces/rest/UserController.kt b/komga/src/main/kotlin/org/gotson/komga/interfaces/rest/UserController.kt index c401c8ed9..86cac4f7c 100644 --- a/komga/src/main/kotlin/org/gotson/komga/interfaces/rest/UserController.kt +++ b/komga/src/main/kotlin/org/gotson/komga/interfaces/rest/UserController.kt @@ -72,7 +72,7 @@ class UserController( if (demo) throw ResponseStatusException(HttpStatus.FORBIDDEN) userRepository.findByEmailIgnoreCaseOrNull(principal.username)?.let { user -> userLifecycle.updatePassword(user, newPasswordDto.password, false) - } ?: throw UsernameNotFoundException(principal.username) + } ?: throw ResponseStatusException(HttpStatus.NOT_FOUND) } @GetMapping @@ -132,7 +132,7 @@ class UserController( if (demo) throw ResponseStatusException(HttpStatus.FORBIDDEN) userRepository.findByIdOrNull(id)?.let { user -> userLifecycle.updatePassword(user, newPasswordDto.password, user.id != principal.user.id) - } ?: throw UsernameNotFoundException(principal.username) + } ?: throw ResponseStatusException(HttpStatus.NOT_FOUND) } @PatchMapping("{id}/shared-libraries")