If there is a finally clause present, it will be executed when exiting the body, through a normal return, uncaught exception or a continuation.
(catch pat body ...+)
(finally body ...+)
> (try (raise "raised string") (catch (? string? e) (display "Caught: " (current-error-port)) (displayln e (current-error-port))))
Caught: raised string
> (try (cons 1) (catch (or (? exn? (app exn-message msg)) (app ~a msg)) msg))
"cons: arity mismatch;\n the expected number of arguments does not match the given number\n expected: 2\n given: 1"
> (displayln (call/cc (lambda (cc) (try (cc "Escaped") (finally (displayln "Escaping"))))))
(try-with ([id val] ...) body ...+)
Like let, bind ids to vals in body. vals are evaluated with current-custodian set to a new custodian created with make-custodian. When the expression returns, the custodian is shutdown with custodian-shutdown-all in a finally clause.
> (custodian-box-value (try-with ([b (make-custodian-box (current-custodian) 'x)]) (displayln (custodian-box-value b)) b))
(try-with* ([id val] ...) body ...+)