Handling error in production code

Sarah Thompson sarah@telergy.com
Fri, 24 Jan 2003 14:54:19 -0000


What is the best way to handle error in production code?

I have successfully built a COM object (many thanks Sigbjorn!!!), which
works fine. The only hassle is that an error being thrown causes the program
using the COM object to hard terminate. This is clearly not desirable,
especially since parse errors can cause this.

What I'd *ideally* like would be for a call to return an error code as an
HRESULT, but leave the internal state of the object unchanged. Is this
feasible? Do I need to think carefully about using something other than
'error'? If so, how do I handle library code's use of error here and there?

TIA,
Sarah