nbaztec
11/09/2020, 8:54 AMcheck
functions? We have a use-case where we'd like to throw a concrete custom Exception. What would be the ideal way to do it?
Wrap it later, but use check
try {
check(<exp>){ "check failed"}
} catch(e: IllegalStateException) {
throw CustomException(e)
}
or throw it directly,
if (<exp>) {
throw CustomException("check failed)
}
df
11/09/2020, 8:59 AMVampire
11/09/2020, 9:58 AMcheck
that throws the exception you want if you prefer the syntax of check
instead of an if
with throw