Re: Try Finally...
From: Rob Kennedy (me3_at_privacy.net)
Date: 10/26/04
- Next message: J French: "Re: Try Finally..."
- Previous message: Rudy Velthuis: "Re: Try Finally..."
- In reply to:(deleted message) L D Blake: "Re: Try Finally..."
- Next in thread: Bjørge Sæther: "Re: Try Finally..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 26 Oct 2004 12:26:31 -0500
L D Blake wrote:
> What should "Finally" do with continuable exceptions?
The same thing it already does: Ignore them.
> Ask why you need string info to handle an exception...
Not necessarily a string, but *some* additional information is
convenient to have. The exception I raise most often is EWin32Error. It
has a property, ErrorCode, which contains the value returned by
GetLastError. That function's range is already DWord, so it is not
feasible to just throw the error code as the exception code. EWin32Error
consolidates all the error codes into a single exception class.
EWin32Error also carries the string message of the error code. It's not
strictly necessary since any anything that catches the exception could
easily call SysErrorMessage on the error code, but then that's something
that would need to be duplicated in each exception handler, so it's more
effective to move that code into the code that creates the exception
instead, even if not *all* handlers require it.
Exceptions that I'm catching lately descend from EIBInterbaseError. It
has a numerical IBErrorCode property as returned by various Firebird API
functions. That error code might be isc_unique_key_violation, but that
number alone doesn't tell me *which* key has been violated. The
information I need is contained in the exception's Message property. I
parse the string, looking for the key name, and then I set focus to the
UI control that corresponds to the database field and ask the user to
enter a different value. I couldn't do that if the exception didn't tell
me which key was violated.
-- Rob
- Next message: J French: "Re: Try Finally..."
- Previous message: Rudy Velthuis: "Re: Try Finally..."
- In reply to:(deleted message) L D Blake: "Re: Try Finally..."
- Next in thread: Bjørge Sæther: "Re: Try Finally..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|