dswitzer
06/25/2025, 5:22 PMbdw429s
06/25/2025, 5:24 PMbdw429s
06/25/2025, 5:24 PMbdw429s
06/25/2025, 5:25 PMdswitzer
06/25/2025, 5:26 PMbdw429s
06/25/2025, 5:27 PMdswitzer
06/25/2025, 5:28 PMbdw429s
06/25/2025, 5:28 PMbdw429s
06/25/2025, 5:29 PMbdw429s
06/25/2025, 5:29 PMbdw429s
06/25/2025, 5:31 PMbdw429s
06/25/2025, 5:32 PMdswitzer
06/25/2025, 5:36 PMthrow("hey") ??: "ignore exception"
That way you have control of the behavior.bdw429s
06/25/2025, 5:41 PMresult = try(
()=>throw("hey"),
(e)=>println( e.message )
)dswitzer
06/25/2025, 5:43 PMbdw429s
06/25/2025, 5:43 PMdswitzer
06/25/2025, 5:43 PMbdw429s
06/25/2025, 7:27 PMFutureNew() BIF, but you could do it directly with Java completable futures, whcich are akin to JS promises.
result = FutureNew( ()->randRange(1,2)==1 ? throw("hey") : "success" )
.onError( e->e.message )
.get()
or, you can even add logic that runs if it succeeds, which doesn't affect the "error path"
result = FutureNew( ()->randRange(1,2)==1 ? throw("hey") : "success" )
.then( v-> "result: " & v )
.onError( e->e.message )
.get()bdw429s
06/25/2025, 7:27 PMbdw429s
06/25/2025, 7:27 PMdswitzer
06/25/2025, 7:28 PMbdw429s
06/25/2025, 7:29 PMbdw429s
06/25/2025, 7:30 PMrunAsync() is similar, but we thought they nerfed their power too much (compared to Java's native completablefuture classes)dswitzer
06/26/2025, 11:53 AM