Can you let me know if the way I think about exceptions is ok?

Thanks,
Daniel Grunblatt.

set I0,0
set I8,10
try
    # User exception
    catch !WRONG_NUMBERS, PRINT_WRONG
    # Trying to catch an exception that was already catched.
    catch !NOT_SUCH_FILE, NEVER_MADE_IT
    print "step 1"
    bsr DIV
end_try # For machine generated code this should not be a problem and makes my life 
easier.
# Catching an exception that (may be) was thrown but not catched. 
catch !NOT_OK, NK
NEVER_MADE_IT:
print "not here"
end

DIV:
    try
        # Predefined exception
        catch !DIVISION_BY_ZERO, RETHROW
        # The default handler dies, so I just wrap it.
        catch !NOT_SUCH_FILE, DISCARD
        print "step #2"
        div I1,I8,I0
        open P1,"doesn't exists","<"
    end_try
    ret

DISCARD:
    print "step #4"
    ret
 
RETHROW:
    print "step #3"
    throw !NOT_OK
    throw !WRONG_NUMBERS
    ret

NK:
    print "step #5"
    end

Reply via email to