perform action and catch possible errors
Parameters
try action :block :bytecode
Attributes
verbose |
|
print all error messages as usual |
Returns
Examples
copy
err: try [
; let's try something dangerous
print 10 / 0
]
type err
; => :error
; Tips: mixing errors and returned values
f: $[][ throw "some error" ]
g: $[][ return "hi" ]
(genericError = err: <= try -> val: f)?
-> print err
-> print val
; => Generic Error: some error
(genericError = err: <= try -> val: g)?
-> print err
-> print val
; => hi
Related