Skip to content

Commit

Permalink
catch login failures on komga
Browse files Browse the repository at this point in the history
  • Loading branch information
nonproto committed Jul 9, 2024
1 parent 22ed129 commit c3bbbd3
Showing 1 changed file with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,17 @@ class Komga : ReducedHttpSource() {

suspend fun loginWithUrl(username: String, password: String, url: String): Boolean {
return withIOContext {
val komgaUrl = "$url/api/v1/series?page=0&size=1".toHttpUrlOrNull()!!.newBuilder()
val response =
createClient(username, password).newCall(GET(komgaUrl.toString(), headers)).await()
response.isSuccessful
try {
val komgaUrl = "$url/api/v1/series?page=0&size=1".toHttpUrlOrNull()!!.newBuilder()
val response =
createClient(username, password)
.newCall(GET(komgaUrl.toString(), headers))
.await()
response.isSuccessful
} catch (e: Exception) {
TimberKt.w(e) { "error logging into komga" }
false
}
}
}

Expand Down

0 comments on commit c3bbbd3

Please sign in to comment.