fix(webui): better error handling for read list matching

This commit is contained in:
Gauthier Roebroeck 2023-03-07 17:24:09 +08:00
parent 1961efe890
commit 53b1137d97
3 changed files with 45 additions and 35 deletions

View file

@ -1,34 +1,37 @@
# Error codes # Error codes
Code | Description | Code | Description |
---|--- |----------|---------------------------------------------------------|
ERR_1000 | File could not be accessed during analysis | ERR_1000 | File could not be accessed during analysis |
ERR_1001 | Media type is not supported during analysis | ERR_1001 | Media type is not supported during analysis |
ERR_1002 | Encrypted RAR archives are not supported | ERR_1002 | Encrypted RAR archives are not supported |
ERR_1003 | Solid RAR archives are not supported | ERR_1003 | Solid RAR archives are not supported |
ERR_1004 | Multi-Volume RAR archives are not supported | ERR_1004 | Multi-Volume RAR archives are not supported |
ERR_1005 | Unknown error while analyzing book | ERR_1005 | Unknown error while analyzing book |
ERR_1006 | Book does not contain any page | ERR_1006 | Book does not contain any page |
ERR_1007 | Some entries could not be analyzed | ERR_1007 | Some entries could not be analyzed |
ERR_1008 | Unknown error while getting book's entries | ERR_1008 | Unknown error while getting book's entries |
ERR_1009 | A read list with that name already exists | ERR_1009 | A read list with that name already exists |
ERR_1010 | No books were matched within the read list request | ERR_1010 | No books were matched within the read list request |
ERR_1011 | No unique match for series | ERR_1011 | No unique match for series |
ERR_1012 | No match for series | ERR_1012 | No match for series |
ERR_1013 | No unique match for book number within series | ERR_1013 | No unique match for book number within series |
ERR_1014 | No 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 ReadingList |
ERR_1016 | Directory not accessible or not a directory | ERR_1016 | Directory not accessible or not a directory |
ERR_1017 | Cannot scan folder that is part of an existing library | ERR_1017 | Cannot scan folder that is part of an existing library |
ERR_1018 | File not found | ERR_1018 | File not found |
ERR_1019 | Cannot import file that is part of an existing library | ERR_1019 | Cannot import file that is part of an existing library |
ERR_1020 | Book to upgrade does not belong to provided series | ERR_1020 | Book to upgrade does not belong to provided series |
ERR_1021 | Destination file already exists | ERR_1021 | Destination file already exists |
ERR_1022 | Newly imported book could not be scanned | ERR_1022 | Newly imported book could not be scanned |
ERR_1023 | Book already present in ReadingList | ERR_1023 | Book already present in ReadingList |
ERR_1024 | OAuth2 login error: no email attribute | ERR_1024 | OAuth2 login error: no email attribute |
ERR_1025 | OAuth2 login error: no local user exist with that email | ERR_1025 | OAuth2 login error: no local user exist with that email |
ERR_1026 | OpenIDConnect login error: email not verified | ERR_1026 | OpenIDConnect login error: email not verified |
ERR_1027 | OpenIDConnect login error: no email_verified attribute | ERR_1027 | OpenIDConnect login error: no email_verified attribute |
ERR_1028 | OpenIDConnect login error: no email 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 |

View file

@ -661,7 +661,7 @@
"ERR_1012": "No match for series", "ERR_1012": "No match for series",
"ERR_1013": "No unique match for book number within series", "ERR_1013": "No unique match for book number within series",
"ERR_1014": "No 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_1016": "Directory not accessible or not a directory",
"ERR_1017": "Cannot scan folder that is part of an existing library", "ERR_1017": "Cannot scan folder that is part of an existing library",
"ERR_1018": "File not found", "ERR_1018": "File not found",
@ -674,7 +674,10 @@
"ERR_1025": "OAuth2 login error: no local user exist with that email", "ERR_1025": "OAuth2 login error: no local user exist with that email",
"ERR_1026": "OpenID Connect login error: email not verified", "ERR_1026": "OpenID Connect login error: email not verified",
"ERR_1027": "OpenID Connect login error: no email_verified attribute", "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": { "filter": {
"age_rating": "age rating", "age_rating": "age rating",

View file

@ -161,8 +161,12 @@ export default Vue.extend({
return this.form.bookIds.filter((b) => b === bookId).length > 1 return this.form.bookIds.filter((b) => b === bookId).length > 1
}, },
async matchFile() { async matchFile() {
this.result = await this.$komgaReadLists.postReadListMatch(this.file) try {
this.form.name = this.result.readListMatch.name 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.summary = ''
this.form.ordered = true this.form.ordered = true
this.form.bookIds = [] this.form.bookIds = []