Updated on 2026-08-14
This commit is contained in:
parent
80d4eeaed9
commit
375afeea12
8 changed files with 78 additions and 0 deletions
1
core/error/.gitignore
vendored
Normal file
1
core/error/.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
/build
|
||||
14
core/error/build.gradle.kts
Normal file
14
core/error/build.gradle.kts
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
plugins {
|
||||
alias(deps.plugins.android.library)
|
||||
alias(deps.plugins.kotlin.android)
|
||||
id("configuration")
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "com.tangem.core.error"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(tangemDeps.card.core)
|
||||
implementation(tangemDeps.blockchain)
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.tangem.core.error
|
||||
|
||||
/**
|
||||
* Universal error interface for all errors in the app.
|
||||
* Each error code must follow this format: xxxyyyzzz where
|
||||
* xxx - Feature code
|
||||
* yyy - Subsystem code
|
||||
* zzz - Specific error code
|
||||
* If you need to add new feature add it to list below incrementing last code.
|
||||
*
|
||||
* Features:
|
||||
* `100` - App error
|
||||
* `101` - TangemSdkError
|
||||
* `102` - BlockchainSdkError
|
||||
* `103` - Express
|
||||
* `104` - Visa
|
||||
* `105` - Staking
|
||||
* `106` - NFT
|
||||
* `107` - WalletConnect
|
||||
*/
|
||||
interface UniversalError {
|
||||
val errorCode: Int
|
||||
}
|
||||
14
core/error/src/main/kotlin/com/tangem/core/error/Utils.kt
Normal file
14
core/error/src/main/kotlin/com/tangem/core/error/Utils.kt
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
package com.tangem.core.error
|
||||
|
||||
import com.tangem.common.core.TangemSdkError
|
||||
import com.tangem.blockchain.common.BlockchainSdkError
|
||||
|
||||
val TangemSdkError.universalError: UniversalError
|
||||
get() = object : UniversalError {
|
||||
override val errorCode: Int = 101000000 + code
|
||||
}
|
||||
|
||||
val BlockchainSdkError.universalError: UniversalError
|
||||
get() = object : UniversalError {
|
||||
override val errorCode: Int = 102000000 + code
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue