Failure

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 }

Inheritors

Types

Link copied to clipboard
data class CryptoError(val error: MXCryptoError) : Failure
Link copied to clipboard
abstract class FeatureFailure : Failure
Link copied to clipboard
data class NetworkConnection(val ioException: IOException? = null) : Failure
Link copied to clipboard
data class OtherServerError(val errorBody: String, val httpCode: Int) : Failure

When server send an error, but it cannot be interpreted as a MatrixError.

Link copied to clipboard
data class RegistrationFlowError(val registrationFlowResponse: RegistrationFlowResponse) : Failure
Link copied to clipboard
data class ServerError(val error: MatrixError, val httpCode: Int) : Failure
Link copied to clipboard
Link copied to clipboard
data class Unknown(val throwable: Throwable? = null) : Failure
Link copied to clipboard
data class UnrecognizedCertificateFailure(val url: String, val fingerprint: Fingerprint) : Failure

Functions

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
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
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

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

Link copied to clipboard

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

Properties

Link copied to clipboard
open val cause: Throwable?
Link copied to clipboard
open val message: String?