Add SessionRestorationException, make sure ClientException can expose it through the cause property
This commit is contained in:
parent
33441d9d40
commit
10224d8e01
5 changed files with 26 additions and 9 deletions
|
|
@ -0,0 +1,15 @@
|
|||
/*
|
||||
* Copyright (c) 2025 Element Creations Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
|
||||
* Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
package io.element.android.libraries.matrix.api.auth
|
||||
|
||||
import io.element.android.libraries.matrix.api.core.SessionId
|
||||
|
||||
sealed class SessionRestorationException(message: String, cause: Throwable? = null) : Exception(message, cause) {
|
||||
data class MissingSession(val sessionId: SessionId) : SessionRestorationException("Session with id $sessionId not found")
|
||||
class InvalidToken : SessionRestorationException("Access token is invalid or expired")
|
||||
}
|
||||
|
|
@ -8,10 +8,10 @@
|
|||
|
||||
package io.element.android.libraries.matrix.api.exception
|
||||
|
||||
sealed class ClientException(message: String, val details: String?) : Exception(message) {
|
||||
class Generic(message: String, details: String?) : ClientException(message, details)
|
||||
class MatrixApi(val kind: ErrorKind, val code: String, message: String, details: String?) : ClientException(message, details)
|
||||
class Other(message: String) : ClientException(message, null)
|
||||
sealed class ClientException(message: String, val details: String?, cause: Throwable? = null) : Exception(message, cause) {
|
||||
class Generic(message: String, details: String?, cause: Throwable? = null) : ClientException(message, details, cause)
|
||||
class MatrixApi(val kind: ErrorKind, val code: String, message: String, details: String?, cause: Throwable? = null) : ClientException(message, details, cause)
|
||||
class Other(message: String, cause: Throwable? = null) : ClientException(message, null, cause)
|
||||
}
|
||||
|
||||
fun ClientException.isNetworkError(): Boolean {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue