diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/Extensions.kt b/app/src/main/java/pl/szczodrzynski/edziennik/Extensions.kt
index af15b543..f27a0e8e 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/Extensions.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/Extensions.kt
@@ -1113,6 +1113,29 @@ fun Throwable.toErrorCode() = when (this) {
else -> null
}
private fun ApiResponse.Error.toErrorCode() = when (this.code) {
+ "PdoError" -> ERROR_API_PDO_ERROR
+ "InvalidClient" -> ERROR_API_INVALID_CLIENT
+ "InvalidArgument" -> ERROR_API_INVALID_ARGUMENT
+ "InvalidSignature" -> ERROR_API_INVALID_SIGNATURE
+ "MissingScopes" -> ERROR_API_MISSING_SCOPES
+ "ResourceNotFound" -> ERROR_API_RESOURCE_NOT_FOUND
+ "InternalServerError" -> ERROR_API_INTERNAL_SERVER_ERROR
+ "PhpError" -> ERROR_API_PHP_E_ERROR
+ "PhpWarning" -> ERROR_API_PHP_E_WARNING
+ "PhpParse" -> ERROR_API_PHP_E_PARSE
+ "PhpNotice" -> ERROR_API_PHP_E_NOTICE
+ "PhpOther" -> ERROR_API_PHP_E_OTHER
+ "ApiMaintenance" -> ERROR_API_MAINTENANCE
+ "MissingArgument" -> ERROR_API_MISSING_ARGUMENT
+ "MissingPayload" -> ERROR_API_PAYLOAD_EMPTY
+ "InvalidAction" -> ERROR_API_INVALID_ACTION
+ "VersionNotFound" -> ERROR_API_UPDATE_NOT_FOUND
+ "InvalidDeviceIdUserCode" -> ERROR_API_INVALID_DEVICEID_USERCODE
+ "InvalidPairToken" -> ERROR_API_INVALID_PAIRTOKEN
+ "InvalidBrowserId" -> ERROR_API_INVALID_BROWSERID
+ "InvalidDeviceId" -> ERROR_API_INVALID_DEVICEID
+ "InvalidDeviceIdBrowserId" -> ERROR_API_INVALID_DEVICEID_BROWSERID
+ "HelpCategoryNotFound" -> ERROR_API_HELP_CATEGORY_NOT_FOUND
else -> ERROR_API_EXCEPTION
}
fun Throwable.toApiError(tag: String) = ApiError.fromThrowable(tag, this)
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/Errors.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/Errors.kt
index 153c30c2..5738064c 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/Errors.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/Errors.kt
@@ -64,6 +64,30 @@ const val ERROR_NO_STUDENTS_IN_ACCOUNT = 115
const val ERROR_CAPTCHA_NEEDED = 3000
const val ERROR_CAPTCHA_LIBRUS_PORTAL = 3001
+const val ERROR_API_PDO_ERROR = 5000
+const val ERROR_API_INVALID_CLIENT = 5001
+const val ERROR_API_INVALID_ARGUMENT = 5002
+const val ERROR_API_INVALID_SIGNATURE = 5003
+const val ERROR_API_MISSING_SCOPES = 5004
+const val ERROR_API_RESOURCE_NOT_FOUND = 5005
+const val ERROR_API_INTERNAL_SERVER_ERROR = 5006
+const val ERROR_API_PHP_E_ERROR = 5007
+const val ERROR_API_PHP_E_WARNING = 5008
+const val ERROR_API_PHP_E_PARSE = 5009
+const val ERROR_API_PHP_E_NOTICE = 5010
+const val ERROR_API_PHP_E_OTHER = 5011
+const val ERROR_API_MAINTENANCE = 5012
+const val ERROR_API_MISSING_ARGUMENT = 5013
+const val ERROR_API_PAYLOAD_EMPTY = 5014
+const val ERROR_API_INVALID_ACTION = 5015
+const val ERROR_API_UPDATE_NOT_FOUND = 5016
+const val ERROR_API_INVALID_DEVICEID_USERCODE = 5017
+const val ERROR_API_INVALID_PAIRTOKEN = 5018
+const val ERROR_API_INVALID_BROWSERID = 5019
+const val ERROR_API_INVALID_DEVICEID = 5020
+const val ERROR_API_INVALID_DEVICEID_BROWSERID = 5021
+const val ERROR_API_HELP_CATEGORY_NOT_FOUND = 5022
+
const val CODE_INTERNAL_LIBRUS_ACCOUNT_410 = 120
const val CODE_INTERNAL_LIBRUS_SYNERGIA_EXPIRED = 121
const val ERROR_LOGIN_LIBRUS_API_CAPTCHA_NEEDED = 124
diff --git a/app/src/main/res/values/errors.xml b/app/src/main/res/values/errors.xml
index 3dabf589..d90af9ed 100644
--- a/app/src/main/res/values/errors.xml
+++ b/app/src/main/res/values/errors.xml
@@ -36,6 +36,30 @@
ERROR_CAPTCHA_NEEDED
ERROR_CAPTCHA_LIBRUS_PORTAL
+ ERROR_API_PDO_ERROR
+ ERROR_API_INVALID_CLIENT
+ ERROR_API_INVALID_ARGUMENT
+ ERROR_API_INVALID_SIGNATURE
+ ERROR_API_MISSING_SCOPES
+ ERROR_API_RESOURCE_NOT_FOUND
+ ERROR_API_INTERNAL_SERVER_ERROR
+ ERROR_API_PHP_E_ERROR
+ ERROR_API_PHP_E_WARNING
+ ERROR_API_PHP_E_PARSE
+ ERROR_API_PHP_E_NOTICE
+ ERROR_API_PHP_E_OTHER
+ ERROR_API_MAINTENANCE
+ ERROR_API_MISSING_ARGUMENT
+ ERROR_API_PAYLOAD_EMPTY
+ ERROR_API_INVALID_ACTION
+ ERROR_API_UPDATE_NOT_FOUND
+ ERROR_API_INVALID_DEVICEID_USERCODE
+ ERROR_API_INVALID_PAIRTOKEN
+ ERROR_API_INVALID_BROWSERID
+ ERROR_API_INVALID_DEVICEID
+ ERROR_API_INVALID_DEVICEID_BROWSERID
+ ERROR_API_HELP_CATEGORY_NOT_FOUND
+
CODE_INTERNAL_LIBRUS_ACCOUNT_410
CODE_INTERNAL_LIBRUS_SYNERGIA_EXPIRED
ERROR_LOGIN_LIBRUS_API_CAPTCHA_NEEDED
@@ -210,6 +234,30 @@
Wymagane rozwiązanie zadania Captcha
LIBRUS®️: wymagane rozwiązanie zadania Captcha
+ ERROR_API_PDO_ERROR
+ Nieprawidłowy ID klienta API
+ API: nieprawidłowy argument
+ Brak dostępu do API
+ Brak uprawnień do zasobu API
+ Nie znaleziono zasobu API
+ Błąd serwera API Szkolny.eu
+ ERROR_API_PHP_E_ERROR
+ ERROR_API_PHP_E_WARNING
+ ERROR_API_PHP_E_PARSE
+ ERROR_API_PHP_E_NOTICE
+ ERROR_API_PHP_E_OTHER
+ API Szkolny.eu: przerwa techniczna
+ API: brakujący argument
+ API: brak przesłanej zawartości
+ ERROR_API_INVALID_ACTION
+ API: nie znaleziono wybranej aktualizacji
+ ERROR_API_INVALID_DEVICEID_USERCODE
+ Nieprawidłowy token przeglądarki
+ ERROR_API_INVALID_BROWSERID
+ ERROR_API_INVALID_DEVICEID
+ ERROR_API_INVALID_DEVICEID_BROWSERID
+ ERROR_API_HELP_CATEGORY_NOT_FOUND
+
CODE_INTERNAL_LIBRUS_ACCOUNT_410
CODE_INTERNAL_LIBRUS_SYNERGIA_EXPIRED
Wymagane wypełnienie CAPTCHA