diff --git a/komga/src/main/kotlin/org/gotson/komga/interfaces/rest/LibraryController.kt b/komga/src/main/kotlin/org/gotson/komga/interfaces/rest/LibraryController.kt index 2e1ba2000..e7b144a63 100644 --- a/komga/src/main/kotlin/org/gotson/komga/interfaces/rest/LibraryController.kt +++ b/komga/src/main/kotlin/org/gotson/komga/interfaces/rest/LibraryController.kt @@ -132,7 +132,18 @@ class LibraryController( emptyTrashAfterScan = library.emptyTrashAfterScan, seriesCover = library.seriesCover.toDomain(), ) - libraryLifecycle.updateLibrary(toUpdate) + try { + libraryLifecycle.updateLibrary(toUpdate) + } catch (e: Exception) { + when (e) { + is FileNotFoundException, + is DirectoryNotFoundException, + is DuplicateNameException, + is PathContainedInPath -> + throw ResponseStatusException(HttpStatus.BAD_REQUEST, e.message) + else -> throw ResponseStatusException(HttpStatus.INTERNAL_SERVER_ERROR) + } + } } ?: throw ResponseStatusException(HttpStatus.NOT_FOUND) } diff --git a/komga/src/main/resources/application.yml b/komga/src/main/resources/application.yml index d58118690..94d3de0bd 100644 --- a/komga/src/main/resources/application.yml +++ b/komga/src/main/resources/application.yml @@ -44,6 +44,8 @@ server: servlet.session.timeout: 7d forward-headers-strategy: framework shutdown: graceful + error: + include-message: always management: endpoints.web.exposure.include: "*"