Add error404 to ErrorInterceptor
This commit is contained in:
parent
3be5e4f3c2
commit
ada0580bd4
1 changed files with 6 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
|||
package io.github.wulkanowy.api.interceptor
|
||||
|
||||
import io.github.wulkanowy.api.ApiException
|
||||
import io.github.wulkanowy.api.login.AccountPermissionException
|
||||
import io.github.wulkanowy.api.login.BadCredentialsException
|
||||
import okhttp3.Interceptor
|
||||
|
@ -39,6 +40,11 @@ class ErrorInterceptor : Interceptor {
|
|||
"Błąd strony" -> throw VulcanException(doc.select(".errorMessage").text())
|
||||
"Logowanie" -> throw AccountPermissionException(doc.select("div").last().html().split("<br>")[1].trim())
|
||||
"Przerwa techniczna" -> throw ServiceUnavailableException(doc.title())
|
||||
"Strona nie została odnaleziona" -> throw ApiException(doc.title())
|
||||
}
|
||||
|
||||
doc.select("h2").text().let {
|
||||
if (it == "Strona nie znaleziona") throw ApiException(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue