/* Test various exceptions and try/catch */

proc nest()
{
    try {
        return nil;
    }
    catch(n) {
        say("Should not get here\n");
    }
}

proc main()
{
    var i = 0, j;

    try {
        say("Before throw\n");
        nest();
        throw "baseball";
        say("Should not get here\n");
    }
    catch(n,f,l) {
        say("Caught ", n, " from file ", f, " line ", l, "\n");
    }

    try
        j = 1 / i;
    catch(n) {
        if( n == oadl::RangeCheck ) {
            say("Exception: ", n, "\n");
        }
        else {
            throw n;
        }
    }
}