Charles Hixson
11/23/2003 4:00:00 PM
T. Onoma wrote:
>Guy:
>
>
>
>>T> ...
>> Then change it : your need of resume in this case...
>>
>>
>
>...i have a user interface script that uses the library. things happen in the library and if the user has set verbose more i should be able to report them to the user ...
>-ts
>
To me it seems that to handle this concern, the proper approach is to
raise the exception within the library, catch it within the library
(actually, within the same routine if possible), if you can't handle it
there, then print out your message and re-raise the exception. Of
course the "printing out of the message" could be handled via a call to
a custom "message handler" routine that serves your needs, so you have
extra place (probably within the library) to specialize things in a more
global way. "resume" is quite tricky if you don't know just where you
will be resuming to (consider what would happen to an external routine
that "resumed" a program structured as I'm proposing). I feel that
resume is normally best used within the same routine that threw the
exception, and that any other use is...dangerous. It is too likely that
later editing will introduce side effects without seeing the problems
that are being caused.