Skip to content

Commit

Permalink
refactor: replace when by if for binary conditions in module `ownclou…
Browse files Browse the repository at this point in the history
…dDomain`
  • Loading branch information
joragua committed Dec 11, 2024
1 parent f5a2801 commit a8c8d78
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,16 @@ sealed class UseCaseResult<out T> {
val isError get() = this is Error

fun getDataOrNull(): T? =
when (this) {
is Success -> data
else -> null
if (this is Success) {
data
} else {
null
}

fun getThrowableOrNull(): Throwable? =
when (this) {
is Error -> throwable
else -> null
if (this is Error) {
throwable
} else {
null
}
}

0 comments on commit a8c8d78

Please sign in to comment.