Package org.matrix.android.sdk.api.failure

Types

Link copied to clipboard
sealed class Failure : Throwable

This class allows to expose different kinds of error to be then handled by the application. As it is a sealed class, you typically use it like that : when(failure) { is NetworkConnection -> Unit is ServerError -> Unit is Unknown -> Unit }

Link copied to clipboard
sealed class GlobalError
Link copied to clipboard
enum InitialSyncRequestReason : Enum<InitialSyncRequestReason>

This enum provide the reason why the SDK request an initial sync to the application.

Link copied to clipboard
@JsonClass(generateAdapter = true)
data class MatrixError(    @Json(name = "errcode") val code: String,     @Json(name = "error") val message: String,     @Json(name = "consent_uri") val consentUri: String? = null,     @Json(name = "limit_type") val limitType: String? = null,     @Json(name = "admin_contact") val adminUri: String? = null,     @Json(name = "retry_after_ms") val retryAfterMillis: Long? = null,     @Json(name = "soft_logout") val isSoftLogout: Boolean? = null,     @Json(name = "lookup_pepper") val newLookupPepper: String? = null,     @Json(name = "session") val session: String? = null,     @Json(name = "completed") val completedStages: List<String>? = null,     @Json(name = "flows") val flows: List<InteractiveAuthenticationFlow>? = null,     @Json(name = "params") val params: JsonDict? = null)

This data class holds the error defined by the matrix specifications. You shouldn't have to instantiate it. Ref: https://matrix.org/docs/spec/client_server/latest#api-standards

Link copied to clipboard
sealed class MatrixIdFailure : Failure.FeatureFailure

Functions

Link copied to clipboard
fun Throwable.getRetryDelay(defaultValue: Long): Long

Get the retry delay in case of rate limit exceeded error, adding 100 ms, of defaultValue otherwise.

Link copied to clipboard
fun Throwable.is400(): Boolean
Link copied to clipboard
fun Throwable.is401(): Boolean
Link copied to clipboard
fun Throwable.is404(): Boolean
Link copied to clipboard
fun Throwable.isHomeserverConnectionError(): Boolean
Link copied to clipboard
fun Throwable.isHomeserverUnavailable(): Boolean
Link copied to clipboard
fun Throwable.isInvalidPassword(): Boolean
Link copied to clipboard
fun Throwable.isInvalidUIAAuth(): Boolean
Link copied to clipboard
fun Throwable.isInvalidUsername(): Boolean
Link copied to clipboard
fun Throwable.isLimitExceededError(): Boolean
Link copied to clipboard
fun Throwable.isLoginEmailUnknown(): Boolean
Link copied to clipboard
fun Throwable.isMissingEmailVerification(): Boolean
Link copied to clipboard
fun Throwable.isRegistrationAvailabilityError(): Boolean
Link copied to clipboard
fun Throwable.isRegistrationDisabled(): Boolean
Link copied to clipboard
fun Throwable.isTokenError(): Boolean
Link copied to clipboard
fun Throwable.isUnrecognisedCertificate(): Boolean
Link copied to clipboard
fun Throwable.isUsernameInUse(): Boolean
Link copied to clipboard
fun Throwable.isWeakPassword(): Boolean
Link copied to clipboard
fun Throwable.shouldBeRetried(): Boolean
Link copied to clipboard

Try to convert to a RegistrationFlowResponse. Return null in the cases it's not possible

Link copied to clipboard
fun Throwable.toScanFailure(): ScanFailure?

Try to convert to a ScanFailure. Return null in the cases it's not possible