robstoll
01/25/2019, 2:01 PMval a = try { myfun()} } catch(T: Throwable){ null }
Bob Glamm
01/25/2019, 2:07 PMarekolek
01/25/2019, 2:08 PMrobstoll
01/25/2019, 2:08 PMrobstoll
01/25/2019, 2:09 PMDavide Giuseppe Farella
01/25/2019, 2:52 PMfun <T: Any?> handle( default: T? = null, block: () -> T ) : T? {
return try {
block()
} catch ( t: Throwable ) {
default
}
}
Marc Knaup
01/25/2019, 9:24 PMval a = runCatching { myfun() }.getOrNull()
Davide Giuseppe Farella
01/25/2019, 9:33 PMrunCatching
for meMarc Knaup
01/25/2019, 11:34 PMinline class
.dave08
01/27/2019, 3:35 AMrunCatching
yet.
But I've upgraded a few projects to 1.3, and it went smoothly, and there are pretty handy changes that made it worth it... runCatching is especially interesting when accumulating `Result`s and acing on them later.Davide Giuseppe Farella
01/27/2019, 8:49 AM