Richard ONeil wrote:
> You could try something like:
> 
> try
>   database.open();
> except
>   on e: exception do
>     if e is edbengineerror then
>     begin
>       raise edatabaseerror.create('omg....something just happened!!');
>     end;
> end;

Sorry, that's a terrible example of catching exceptions, for two reasons:

1. If the code in the "try" section raises anything other than an 
EDBEngineError, it will be caught and ignored. You'll never know about 
it at run time. Never catch an exception that you don't know how to handle.

except
   on E: EDBEngineError do begin
     // ...
   end;
end;

2. It hides the original exception by raising a new, less specific 
exception with a meaningless error message. It also throws away the 
database error code. I'm not sure, but it might also clobber whatever 
stack trace might have been available from a debugging library like 
JclDebug.

-- 
Rob


-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED] 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/delphi-en/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to