SV: Good practice for error-handling
Kim Gräsman <[email protected]> Thu, 5 Sep 2002 22:10:06 +0200
| Newsgroups | gmane.comp.windows.devel.oledb.devel |
|---|---|
| Message-ID | <[email protected]> |
Patrick,
=20
Thanks a lot for the info. Does it end up in the standard COM error =
info, or OLEDB's own error collection?
=20
Cheers,
Kim
-----Ursprungligt meddelande-----=20
Fr=E5n: Patrick Hoeffel [mailto:[email protected]]=20
Skickat: to 2002-09-05 21:29=20
Till: [email protected]=20
Kopia:=20
=C4mne: Re: Good practice for error-handling
=09
=09
Kim,=20
Yes, the Open() call will return a failed HRESULT if you RAISEERROR. We =
do this routinely. The text of the raised error will be returned so that =
you display it to the user or log it or whatever you want to do. Take =
note, however, of the error level you indicate in your error. RAISEERROR =
with error level 18 will cause the stored procedure to exit immediately, =
while lower error levels (I don't remember the exact mappings - check =
Books Online) will still return an error result and text, but will allow =
the procedure to finish.
The text is returned just like any other OLE DB text messages. Let me =
know if you need sample code.=20
Patrick Hoeffel=20
-----Original Message-----=20
From: Kim Gr=E4sman [mailto:[email protected]]=20
Sent: Thursday, September 05, 2002 1:15 PM=20
To: [email protected]=20
Subject: [OLEDB_DEV] Good practice for error-handling=20
Hello,=20
=20
I've been a bit unhappy with our error handling for a while. We've got =
a bunch of COM components using the ATL OLEDB wrappers exclusively to =
execute stored procedures.
=09
Sometimes the sp's are simple SELECT's, and sometimes they contain more =
logic. For the latter category, sometimes I feel like raising specific =
errors on sp-logic rather than referential integrity.
=09
How can I manage this? Does RAISEERROR come out as an HRESULT?=20
=20
Thankful for any pointers,=20
Kim=20
You can read messages from the OLEDB_DEV archive, unsubscribe from =
OLEDB_DEV,=20
or subscribe to other DevelopMentor lists at =
http://discuss.develop.com.=20
You can read messages from the OLEDB_DEV archive, unsubscribe from =
OLEDB_DEV, or subscribe to other DevelopMentor lists at =
http://discuss.develop.com.=20
You can read messages from the OLEDB_DEV archive, unsubscribe from OLEDB_DEV,
or subscribe to other DevelopMentor lists at http://discuss.develop.com.