The trap block runs any time an error needs to be handled.
Unlike catch
in other languages, it does not divert the control flow to the
end of the block. Instead, control flow is returned to the line immedately
following where the error was "trapped".
Trapping an error follows a similar syntax to ignoring an error; instead of
using _
, use ?
.