Standard library
Error
The Error class does not contain any methods.
It works with a basic string, or with the built-in error from
catch.
That is the whole personality.
including "stdlib/error.alana"; then throw newobj Error(...);
Catch the built-in error
catch(error) binds the messy thing that exploded.
Wrap it in Error if you want to throw it again with a proper name.
including "stdlib/error.alana";
try;
showln "Hello";
end;
catch(error);
throw newobj Error(error);
end;
Throw a string
You may also hand Error a sentence. She will carry it.
including "stdlib/error.alana";
throw newobj Error("Error 1: wrong type");
Language-level
try / catch / finally / throw
live under
try / catch / throw.
This page is only the stdlib object you throw.