meeting log January 30, 2001

Phillip J Shelton shelton11@dingoblue.net.au
Sat, 03 Feb 2001 06:13:16 +1000


So, put the CATCH before the parse-packet??

Derek Atkins wrote:

> Except you still need to check error status/return values anyways.
> Consider that if you throw an exception, you may not have appropriate
> state to continue processing.  This implies that you must stop
> processing and reverse up the stack until the exception is handled.
>
> Take for instance a code snippet that looks like this:
>
>         TRY {
>                 read_packet(packet, port);
>                 parse_packet(packet);
>         }
>         CATCH {
>         read_error:
>                 close_port(port);
>         }
>
> So, what happens if read_packet throws an exception?  It means you
> CANNOT continue to parse_packet, because packet would contain invalid
> data.
>
> So, you still have to check for error conditions at every function
> call that is expected to throw an exception.
>
> -derek