Ruckus
12/03/2019, 4:59 PMlaunch { field.setAs { calculate() } }
...
private fun StringProperty.setAs(calc: () -> Any) = set(
try {
calc().toString()
} catch (e: Exception) {
e.message
}
)
(Note that setAs
has no suspension at all)
But if calc
throws an exception, it isn't caught and instead just crashes. Am I missing something obvious?streetsofboston
12/03/2019, 5:04 PMThrowable
instead of an Exception
?Ruckus
12/03/2019, 5:05 PMError
being thrown, not an Exception
. Thanks!