Error handling
The Android PoqSDK uses RxJava for the communication between layers but it does not uses its internal mechanism to handle errors. Instead, it wraps the return type with PoqResult<{ReturnType},{ErrorType}>
which is a sealed class with two types: Success
and Failure
. PoqResult.Success
holds a value and PoqResult.Failure
holds an error.
In most cases, the error type is PoqError
and you can use this generic mapper to map it to a String:
private val errorToErrorStringMapperFactory: Mapper<String, PoqError> by inject(named(poqErrorToErrorStringMapperName))