From 5ba13d0bb8a5fbe9b941391f35619309a12b85f3 Mon Sep 17 00:00:00 2001 From: Gauthier Roebroeck Date: Wed, 16 Jul 2025 11:24:45 +0800 Subject: [PATCH] refactor: rename unused exceptions --- .../komga/interfaces/api/CommonBookController.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/CommonBookController.kt b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/CommonBookController.kt index 061f6f9d7..d9fbf9dce 100644 --- a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/CommonBookController.kt +++ b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/CommonBookController.kt @@ -180,11 +180,11 @@ class CommonBookController( ).contentType(getMediaTypeOrDefault(pageContent.mediaType)) .setNotModified(media) .body(pageContent.bytes) - } catch (ex: IndexOutOfBoundsException) { + } catch (_: IndexOutOfBoundsException) { throw ResponseStatusException(HttpStatus.BAD_REQUEST, "Page number does not exist") } catch (ex: ImageConversionException) { throw ResponseStatusException(HttpStatus.NOT_FOUND, ex.message) - } catch (ex: MediaNotReadyException) { + } catch (_: MediaNotReadyException) { throw ResponseStatusException(HttpStatus.NOT_FOUND, "Book analysis failed") } catch (ex: NoSuchFileException) { logger.warn(ex) { "File not found: $book" } @@ -244,11 +244,11 @@ class CommonBookController( ).contentType(getMediaTypeOrDefault(pageContent.mediaType)) .setNotModified(media) .body(pageContent.bytes) - } catch (ex: IndexOutOfBoundsException) { + } catch (_: IndexOutOfBoundsException) { throw ResponseStatusException(HttpStatus.BAD_REQUEST, "Page number does not exist") } catch (ex: MediaUnsupportedException) { throw ResponseStatusException(HttpStatus.BAD_REQUEST, ex.message) - } catch (ex: MediaNotReadyException) { + } catch (_: MediaNotReadyException) { throw ResponseStatusException(HttpStatus.NOT_FOUND, "Book analysis failed") } catch (ex: NoSuchFileException) { logger.warn(ex) { "File not found: $book" } @@ -293,7 +293,7 @@ class CommonBookController( val bytes = try { bookAnalyzer.getFileContent(BookWithMedia(book, media), resourceName) - } catch (e: EntryNotFoundException) { + } catch (_: EntryNotFoundException) { throw ResponseStatusException(HttpStatus.NOT_FOUND) }