Errors

try

Run a block with error handling standing by.

Syntax

try;
    ...
end;
catch(<name>);
    ...
end;

How she behaves

  • Close the try body with end; before catch.
  • catch receives the error. finally, if you want it, runs either way.
  • Pair with throw, and with stdlib/error.alana if you want a proper Error object.

Example

try;
    showln call SendRequest("GET", url, body);
end;
catch(error);
    throw newobj Error(error);
end;

See also