From bb0cac85530a821f727fbc8d3c6aff8c77c7d64f Mon Sep 17 00:00:00 2001 From: aarbit Date: Thu, 6 Jun 2024 00:23:39 -0500 Subject: [PATCH] Adds album hash not found error handling --- .../prettyplayerapi/exception/GlobalExceptionHandler.kt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/kotlin/net/halfbinary/prettyplayerapi/exception/GlobalExceptionHandler.kt b/src/main/kotlin/net/halfbinary/prettyplayerapi/exception/GlobalExceptionHandler.kt index 0a54af8..7420245 100644 --- a/src/main/kotlin/net/halfbinary/prettyplayerapi/exception/GlobalExceptionHandler.kt +++ b/src/main/kotlin/net/halfbinary/prettyplayerapi/exception/GlobalExceptionHandler.kt @@ -13,6 +13,13 @@ class GlobalExceptionHandler { ErrorResponse(HttpStatus.INTERNAL_SERVER_ERROR.value(), e.message ?:""), HttpStatus.INTERNAL_SERVER_ERROR) } + + @ExceptionHandler + fun handleAlbumHashNotFoundException(e: AlbumHashNotFoundException): ResponseEntity { + return ResponseEntity( + ErrorResponse(HttpStatus.BAD_REQUEST.value(), + e.message ?:""), HttpStatus.BAD_REQUEST) + } @ExceptionHandler fun handleException(e: RuntimeException): ResponseEntity { return ResponseEntity(