in reply to Error module

To answer the second part of your question: you shouldn't return to the try block once an exception has been thrown. The exception indicates that some abnormal condition has occured (say for instance, a file couldn't be opened), so the rest of the code in the try block should not be executed since it would lead to unpredictable behaviour or simply crash the program.

Just my 2 cents, -gjb-

Update: As to dragonchild's remark below: in such a case it's cleaner to work with a finer granularity for the try/catch. I.e. if the caller doesn't consider the exception an error, only the statement generating it should be put in the try/catch construct, no other statements that can be executed regardless of the nature of the exception or after the catch block has done some recovery.

Replies are listed 'Best First'.
Re2: Error module
by dragonchild (Archbishop) on Aug 18, 2003 at 14:13 UTC
    That's not always true. There are times a module might consider something a failure, but the caller might not. For example, I have a program that uses die to throw signals that aren't exceptions. While I don't have it coded this way, I could easily see using that facility of Error.

    ------
    We are the carpenters and bricklayers of the Information Age.

    The idea is a little like C++ templates, except not quite so brain-meltingly complicated. -- TheDamian, Exegesis 6

    Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.