diff --git a/data/staking/src/main/java/com/tangem/data/staking/DefaultStakingErrorResolver.kt b/data/staking/src/main/java/com/tangem/data/staking/DefaultStakingErrorResolver.kt index 59f650e5ee..e6bcd058c8 100644 --- a/data/staking/src/main/java/com/tangem/data/staking/DefaultStakingErrorResolver.kt +++ b/data/staking/src/main/java/com/tangem/data/staking/DefaultStakingErrorResolver.kt @@ -26,8 +26,8 @@ internal class DefaultStakingErrorResolver( is StakingError.StakeKitUnknownError -> { analyticsEventHandler.send(StakingAnalyticsEvent.StakeKitApiUnknownError(error)) } - else -> { - // intentionally do nothing + is StakingError.DomainError -> { + analyticsEventHandler.send(StakingAnalyticsEvent.DomainError(error)) } } diff --git a/domain/staking/src/main/java/com/tangem/domain/staking/analytics/StakingAnalyticsEvent.kt b/domain/staking/src/main/java/com/tangem/domain/staking/analytics/StakingAnalyticsEvent.kt index 7fbd04f22f..7efa373d1f 100644 --- a/domain/staking/src/main/java/com/tangem/domain/staking/analytics/StakingAnalyticsEvent.kt +++ b/domain/staking/src/main/java/com/tangem/domain/staking/analytics/StakingAnalyticsEvent.kt @@ -136,6 +136,15 @@ sealed class StakingAnalyticsEvent( }, ) + data class DomainError( + val stakeKitDomainError: StakingError.DomainError, + ) : StakingAnalyticsEvent( + event = "App Errors", + params = buildMap { + addIfValueIsNotNull(AnalyticsParam.ERROR_DESCRIPTION, stakeKitDomainError.message) + }, + ) + fun MutableMap.addIfValueIsNotNull(key: String, value: Any?) { if (value != null) { put(key, value.toString())