forked from github/szkolny
[API] Add API error codes and descriptions.
This commit is contained in:
parent
93233f6afa
commit
3093850a4a
@ -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)
|
||||
|
@ -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
|
||||
|
@ -36,6 +36,30 @@
|
||||
<string name="error_3000" translatable="false">ERROR_CAPTCHA_NEEDED</string>
|
||||
<string name="error_3001" translatable="false">ERROR_CAPTCHA_LIBRUS_PORTAL</string>
|
||||
|
||||
<string name="error_5000" translatable="false">ERROR_API_PDO_ERROR</string>
|
||||
<string name="error_5001" translatable="false">ERROR_API_INVALID_CLIENT</string>
|
||||
<string name="error_5002" translatable="false">ERROR_API_INVALID_ARGUMENT</string>
|
||||
<string name="error_5003" translatable="false">ERROR_API_INVALID_SIGNATURE</string>
|
||||
<string name="error_5004" translatable="false">ERROR_API_MISSING_SCOPES</string>
|
||||
<string name="error_5005" translatable="false">ERROR_API_RESOURCE_NOT_FOUND</string>
|
||||
<string name="error_5006" translatable="false">ERROR_API_INTERNAL_SERVER_ERROR</string>
|
||||
<string name="error_5007" translatable="false">ERROR_API_PHP_E_ERROR</string>
|
||||
<string name="error_5008" translatable="false">ERROR_API_PHP_E_WARNING</string>
|
||||
<string name="error_5009" translatable="false">ERROR_API_PHP_E_PARSE</string>
|
||||
<string name="error_5010" translatable="false">ERROR_API_PHP_E_NOTICE</string>
|
||||
<string name="error_5011" translatable="false">ERROR_API_PHP_E_OTHER</string>
|
||||
<string name="error_5012" translatable="false">ERROR_API_MAINTENANCE</string>
|
||||
<string name="error_5013" translatable="false">ERROR_API_MISSING_ARGUMENT</string>
|
||||
<string name="error_5014" translatable="false">ERROR_API_PAYLOAD_EMPTY</string>
|
||||
<string name="error_5015" translatable="false">ERROR_API_INVALID_ACTION</string>
|
||||
<string name="error_5016" translatable="false">ERROR_API_UPDATE_NOT_FOUND</string>
|
||||
<string name="error_5017" translatable="false">ERROR_API_INVALID_DEVICEID_USERCODE</string>
|
||||
<string name="error_5018" translatable="false">ERROR_API_INVALID_PAIRTOKEN</string>
|
||||
<string name="error_5019" translatable="false">ERROR_API_INVALID_BROWSERID</string>
|
||||
<string name="error_5020" translatable="false">ERROR_API_INVALID_DEVICEID</string>
|
||||
<string name="error_5021" translatable="false">ERROR_API_INVALID_DEVICEID_BROWSERID</string>
|
||||
<string name="error_5022" translatable="false">ERROR_API_HELP_CATEGORY_NOT_FOUND</string>
|
||||
|
||||
<string name="error_120" translatable="false">CODE_INTERNAL_LIBRUS_ACCOUNT_410</string>
|
||||
<string name="error_121" translatable="false">CODE_INTERNAL_LIBRUS_SYNERGIA_EXPIRED</string>
|
||||
<string name="error_124" translatable="false">ERROR_LOGIN_LIBRUS_API_CAPTCHA_NEEDED</string>
|
||||
@ -210,6 +234,30 @@
|
||||
<string name="error_3000_reason">Wymagane rozwiązanie zadania Captcha</string>
|
||||
<string name="error_3001_reason">LIBRUS®️: wymagane rozwiązanie zadania Captcha</string>
|
||||
|
||||
<string name="error_5000_reason">ERROR_API_PDO_ERROR</string>
|
||||
<string name="error_5001_reason">Nieprawidłowy ID klienta API</string>
|
||||
<string name="error_5002_reason">API: nieprawidłowy argument</string>
|
||||
<string name="error_5003_reason">Brak dostępu do API</string>
|
||||
<string name="error_5004_reason">Brak uprawnień do zasobu API</string>
|
||||
<string name="error_5005_reason">Nie znaleziono zasobu API</string>
|
||||
<string name="error_5006_reason">Błąd serwera API Szkolny.eu</string>
|
||||
<string name="error_5007_reason">ERROR_API_PHP_E_ERROR</string>
|
||||
<string name="error_5008_reason">ERROR_API_PHP_E_WARNING</string>
|
||||
<string name="error_5009_reason">ERROR_API_PHP_E_PARSE</string>
|
||||
<string name="error_5010_reason">ERROR_API_PHP_E_NOTICE</string>
|
||||
<string name="error_5011_reason">ERROR_API_PHP_E_OTHER</string>
|
||||
<string name="error_5012_reason">API Szkolny.eu: przerwa techniczna</string>
|
||||
<string name="error_5013_reason">API: brakujący argument</string>
|
||||
<string name="error_5014_reason">API: brak przesłanej zawartości</string>
|
||||
<string name="error_5015_reason">ERROR_API_INVALID_ACTION</string>
|
||||
<string name="error_5016_reason">API: nie znaleziono wybranej aktualizacji</string>
|
||||
<string name="error_5017_reason">ERROR_API_INVALID_DEVICEID_USERCODE</string>
|
||||
<string name="error_5018_reason">Nieprawidłowy token przeglądarki</string>
|
||||
<string name="error_5019_reason">ERROR_API_INVALID_BROWSERID</string>
|
||||
<string name="error_5020_reason">ERROR_API_INVALID_DEVICEID</string>
|
||||
<string name="error_5021_reason">ERROR_API_INVALID_DEVICEID_BROWSERID</string>
|
||||
<string name="error_5022_reason">ERROR_API_HELP_CATEGORY_NOT_FOUND</string>
|
||||
|
||||
<string name="error_120_reason">CODE_INTERNAL_LIBRUS_ACCOUNT_410</string>
|
||||
<string name="error_121_reason">CODE_INTERNAL_LIBRUS_SYNERGIA_EXPIRED</string>
|
||||
<string name="error_124_reason">Wymagane wypełnienie CAPTCHA</string>
|
||||
|
Loading…
Reference in New Issue
Block a user