Error Handling 3
- This will print
-1 had error.
import std::io;
faultdef SOMETHING_MISSING, GENERAL_ERROR_WAS_HERE;
fn void? x(int i)
{
if (i < 0) return SOMETHING_MISSING~;
}
fn void main()
{
fault y = @catch(x(10));
if (y) io::printfn("10 had error.");
y = @catch(x(-1));
if (y) io::printfn("-1 had error.");
}