JanetDocsI'm feeling luckyGitHub sign in

try



    macro
    boot.janet on line 232, column 1

    (try body catch)

    Try something and catch errors. Body is any expression, and catch
    should be a form with the first element 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)))
swlkr