
dev.forcetower.breaker.result.Outcome.kt Maven / Gradle / Ivy
package dev.forcetower.breaker.result
sealed class Outcome {
data class Success(val value: T) : Outcome()
data class Error(val error: Throwable, val code: Int): Outcome()
val isSuccess: Boolean
get() = this is Success
companion object {
fun success(value: T): Success {
return Success(value)
}
fun error(error: Throwable, code: Int = 500): Error {
return Error(error, code)
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy