Updated on 2026-08-14
This commit is contained in:
parent
ff282a1d7d
commit
65a55cb5e3
23 changed files with 222 additions and 144 deletions
8
common/src/main/java/com/tangem/common/Validator.kt
Normal file
8
common/src/main/java/com/tangem/common/Validator.kt
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
package com.tangem.common
|
||||
|
||||
/**
|
||||
[REDACTED_AUTHOR]
|
||||
*/
|
||||
interface Validator<Data, Error> {
|
||||
fun validate(data: Data? = null): Error?
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package com.tangem.common.module
|
||||
|
||||
/**
|
||||
[REDACTED_AUTHOR]
|
||||
* A module exception
|
||||
*/
|
||||
interface ModuleException {
|
||||
val message: String
|
||||
}
|
||||
|
||||
/**
|
||||
* An exception marked as FbConsumeException should be submitted to Firebase.Crashlytics as a non-fatal issue.
|
||||
*/
|
||||
interface FbConsumeException
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package com.tangem.common.module
|
||||
|
||||
/**
|
||||
[REDACTED_AUTHOR]
|
||||
* The base object for communication between modules
|
||||
*/
|
||||
interface ModuleMessage
|
||||
|
||||
interface ModuleMessageConverter<ModuleMessage, R> {
|
||||
fun convert(message: ModuleMessage): R
|
||||
}
|
||||
|
||||
/**
|
||||
* @property code describes what feature is the error coming from
|
||||
* @property message the error description
|
||||
* @property data any data that can help in the part where this error is being handled
|
||||
*/
|
||||
interface ModuleError : ModuleMessage {
|
||||
val code: Int
|
||||
val message: String
|
||||
val data: Any?
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue