File tree Expand file tree Collapse file tree 1 file changed +0
-24
lines changed
app/src/main/java/com/monstarlab/arch/extensions Expand file tree Collapse file tree 1 file changed +0
-24
lines changed Original file line number Diff line number Diff line change @@ -28,27 +28,3 @@ inline fun <T, R> Response<T>.mapSuccess(
28
28
throw toError()
29
29
}
30
30
}
31
-
32
- sealed class RepositoryResult <out T > {
33
- data class Success <T >(val value : T ): RepositoryResult<T>()
34
- data class Error (val error : ErrorModel ): RepositoryResult<Nothing>()
35
- }
36
-
37
- inline fun <T > RepositoryResult<T>.onSuccess (block : (T ) -> Unit ): RepositoryResult <T > {
38
- if (this is RepositoryResult .Success ) block.invoke(value)
39
- return this
40
- }
41
-
42
- inline fun <T > RepositoryResult<T>.onError (block : (ErrorModel ) -> Unit ): RepositoryResult <T > {
43
- if (this is RepositoryResult .Error ) block.invoke(error)
44
- return this
45
- }
46
-
47
- fun <T > RepositoryResult<T>.isError (): Boolean {
48
- return this is RepositoryResult .Error
49
- }
50
-
51
- val <T > RepositoryResult <T >.errorOrNull: ErrorModel ?
52
- get() {
53
- return if (this is RepositoryResult .Error ) error else null
54
- }
You can’t perform that action at this time.
0 commit comments