JanetDocsPlaygroundI'm feeling luckyGitHub sign in

try



    macro
    boot.janet on line 249, column 1

    (try body catch)

    Try something and catch errors. `body` is any expression, and 
    `catch` should be a form, the first element of which is a tuple. 
    This tuple should contain a binding for errors and an optional 
    binding for the fiber wrapping the body. Returns the result of 
    `body` if no error, or the result of `catch` if an error.


1 exampleSign in to add an example
Loading...
# catch and propagate an error with fiber

(try
  (+ 1 nil)
  ([err fib]
   (propagate err fib)))
swlkrPlayground