Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- abstract class ResultUseCaseWithErrorLogging<P, R>(
- private val logEvents: Events,
- ) {
- operator fun invoke(params: P): Flow<Result<R>> = flow {
- emit(
- doWork(params)
- .onFailure { error: Throwable ->
- logEvents.exception(this::class.qualifiedName) { error }
- }
- )
- }
- protected abstract suspend fun doWork(params: P): Result<R>
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement