CLOVIS
03/28/2023, 8:00 AMcontext
will work on the primary constructor, so will something like this work?
sealed class PasswordValidationError {
object TooShort : PasswordValidationError()
}
value class Password context(Raise<PasswordValidationError>) constructor(val text: String) {
init {
ensure(text.length > 8) { PasswordValidationError.TooShort }
}
}
simon.vergauwen
03/28/2023, 8:09 AMCancellationException
, I know it wraps some exceptions but I haven't looked deeply into it.CLOVIS
03/28/2023, 8:11 AMsimon.vergauwen
03/28/2023, 8:17 AMrequire
and do something like this: https://github.com/nomisRev/ktor-arrow-example/blob/2ec99199bee7c80633834450f811ff1610a3cfd0/src/main/kotlin/io/github/nomisrev/routes/users.kt#L105
catchOrThrow
is in line with reified Raise.catch
but for Either
😉CLOVIS
03/28/2023, 8:17 AM