Updated on 2026-08-14

This commit is contained in:
Tangem 2024-10-23 14:58:44 +03:00
parent 34a17e2c65
commit b1ced989ae
8 changed files with 26 additions and 20 deletions

View file

@ -13,7 +13,7 @@ internal class DefaultStakingErrorResolver(
return if (throwable is ApiResponseError.HttpException) {
stakeKitErrorConverter.convert(throwable.errorBody.orEmpty())
} else {
StakingError.UnknownError
StakingError.UnknownError()
}
}
}

View file

@ -14,7 +14,7 @@ internal class StakeKitErrorConverter(
@Suppress("CyclomaticComplexMethod", "LongMethod")
override fun convert(value: String): StakingError {
return try {
val stakeKitErrorResponse = jsonAdapter.fromJson(value) ?: return StakingError.UnknownError
val stakeKitErrorResponse = jsonAdapter.fromJson(value) ?: return StakingError.UnknownError(value)
if (stakeKitErrorResponse.type == AccessDeniedErrorTypeDTO.GEO_LOCATION) {
StakingError.UnavailableDueToGeolocationError(
@ -106,10 +106,10 @@ internal class StakeKitErrorConverter(
StakingError.GRTStakingDisabledError
StakeKitErrorMessageDTO.GRT_STAKING_DISABLED_LEDGER_LIVE_ERROR ->
StakingError.GRTStakingDisabledLedgerLiveError
else -> StakingError.UnknownError
else -> StakingError.UnknownError(value)
}
} catch (e: Exception) {
StakingError.UnknownError
StakingError.UnknownError(value)
}
}
}