From 53b1137d970f54171c9ac6674aba6c8ff51860f9 Mon Sep 17 00:00:00 2001 From: Gauthier Roebroeck Date: Tue, 7 Mar 2023 17:24:09 +0800 Subject: [PATCH] fix(webui): better error handling for read list matching --- ERRORCODES.md | 65 +++++++++++++----------- komga-webui/src/locales/en.json | 7 ++- komga-webui/src/views/ImportReadList.vue | 8 ++- 3 files changed, 45 insertions(+), 35 deletions(-) diff --git a/ERRORCODES.md b/ERRORCODES.md index f998c71c0..5e0ba285d 100644 --- a/ERRORCODES.md +++ b/ERRORCODES.md @@ -1,34 +1,37 @@ # Error codes -Code | Description ----|--- -ERR_1000 | File could not be accessed during analysis -ERR_1001 | Media type is not supported during analysis -ERR_1002 | Encrypted RAR archives are not supported -ERR_1003 | Solid RAR archives are not supported -ERR_1004 | Multi-Volume RAR archives are not supported -ERR_1005 | Unknown error while analyzing book -ERR_1006 | Book does not contain any page -ERR_1007 | Some entries could not be analyzed -ERR_1008 | Unknown error while getting book's entries -ERR_1009 | A read list with that name already exists -ERR_1010 | No books were matched within the read list request -ERR_1011 | No unique match for series -ERR_1012 | No match for series -ERR_1013 | No unique match for book number within series -ERR_1014 | No match for book number within series -ERR_1015 | Error while deserializing ComicRack ReadingList -ERR_1016 | Directory not accessible or not a directory -ERR_1017 | Cannot scan folder that is part of an existing library -ERR_1018 | File not found -ERR_1019 | Cannot import file that is part of an existing library -ERR_1020 | Book to upgrade does not belong to provided series -ERR_1021 | Destination file already exists -ERR_1022 | Newly imported book could not be scanned -ERR_1023 | Book already present in ReadingList -ERR_1024 | OAuth2 login error: no email attribute -ERR_1025 | OAuth2 login error: no local user exist with that email -ERR_1026 | OpenIDConnect login error: email not verified -ERR_1027 | OpenIDConnect login error: no email_verified attribute -ERR_1028 | OpenIDConnect login error: no email attribute +| Code | Description | +|----------|---------------------------------------------------------| +| ERR_1000 | File could not be accessed during analysis | +| ERR_1001 | Media type is not supported during analysis | +| ERR_1002 | Encrypted RAR archives are not supported | +| ERR_1003 | Solid RAR archives are not supported | +| ERR_1004 | Multi-Volume RAR archives are not supported | +| ERR_1005 | Unknown error while analyzing book | +| ERR_1006 | Book does not contain any page | +| ERR_1007 | Some entries could not be analyzed | +| ERR_1008 | Unknown error while getting book's entries | +| ERR_1009 | A read list with that name already exists | +| ERR_1010 | No books were matched within the read list request | +| ERR_1011 | No unique match for series | +| ERR_1012 | No match for series | +| ERR_1013 | No unique match for book number within series | +| ERR_1014 | No match for book number within series | +| ERR_1015 | Error while deserializing ComicRack ReadingList | +| ERR_1016 | Directory not accessible or not a directory | +| ERR_1017 | Cannot scan folder that is part of an existing library | +| ERR_1018 | File not found | +| ERR_1019 | Cannot import file that is part of an existing library | +| ERR_1020 | Book to upgrade does not belong to provided series | +| ERR_1021 | Destination file already exists | +| ERR_1022 | Newly imported book could not be scanned | +| ERR_1023 | Book already present in ReadingList | +| ERR_1024 | OAuth2 login error: no email attribute | +| ERR_1025 | OAuth2 login error: no local user exist with that email | +| ERR_1026 | OpenIDConnect login error: email not verified | +| ERR_1027 | OpenIDConnect login error: no email_verified attribute | +| ERR_1028 | OpenIDConnect login error: no email attribute | +| ERR_1029 | ComicRack CBL does not contain any Book element | +| ERR_1030 | ComicRack CBL has no Name element | +| ERR_1031 | ComicRack CBL Book is missing series or number | diff --git a/komga-webui/src/locales/en.json b/komga-webui/src/locales/en.json index 951ec73a2..7eb2d448e 100644 --- a/komga-webui/src/locales/en.json +++ b/komga-webui/src/locales/en.json @@ -661,7 +661,7 @@ "ERR_1012": "No match for series", "ERR_1013": "No unique match for book number within series", "ERR_1014": "No match for book number within series", - "ERR_1015": "Error while deserializing ComicRack ReadingList", + "ERR_1015": "Error while deserializing ComicRack CBL", "ERR_1016": "Directory not accessible or not a directory", "ERR_1017": "Cannot scan folder that is part of an existing library", "ERR_1018": "File not found", @@ -674,7 +674,10 @@ "ERR_1025": "OAuth2 login error: no local user exist with that email", "ERR_1026": "OpenID Connect login error: email not verified", "ERR_1027": "OpenID Connect login error: no email_verified attribute", - "ERR_1028": "OpenID Connect login error: no email attribute" + "ERR_1028": "OpenID Connect login error: no email attribute", + "ERR_1029": "ComicRack CBL does not contain any Book element", + "ERR_1030": "ComicRack CBL has no Name element", + "ERR_1031": "ComicRack CBL Book is missing series or number" }, "filter": { "age_rating": "age rating", diff --git a/komga-webui/src/views/ImportReadList.vue b/komga-webui/src/views/ImportReadList.vue index 7f8655cdc..e8087cc11 100644 --- a/komga-webui/src/views/ImportReadList.vue +++ b/komga-webui/src/views/ImportReadList.vue @@ -161,8 +161,12 @@ export default Vue.extend({ return this.form.bookIds.filter((b) => b === bookId).length > 1 }, async matchFile() { - this.result = await this.$komgaReadLists.postReadListMatch(this.file) - this.form.name = this.result.readListMatch.name + try { + this.result = await this.$komgaReadLists.postReadListMatch(this.file) + this.form.name = this.result.readListMatch.name + } catch (e) { + this.$eventHub.$emit(ERROR, {message: convertErrorCodes(e.message)} as ErrorEvent) + } this.form.summary = '' this.form.ordered = true this.form.bookIds = []