Fatal Error Handling
-
I have a COM collection object that maintains two STL containers. While it is unlikely, it is possible that an exception will be thrown while the containers are out of sync. In a normal application, I would simply abort under those conditions. What should an in process COM server do if such a fatal error occurs? Nathan
-
I have a COM collection object that maintains two STL containers. While it is unlikely, it is possible that an exception will be thrown while the containers are out of sync. In a normal application, I would simply abort under those conditions. What should an in process COM server do if such a fatal error occurs? Nathan
Nathan, Usually, Exceptions in COM server shouldn't bubble up. Since it's an inproc server, aborting would terminate your client application. I don't know any solution that I have implemented but does any of the following help you device a framework - 1. Supporting ISupportErrorInfo for rich error information and your methods could fail with some HRESULT. Client is expected to take necessary action. 2. Not a good one, but if these are internal error and assuming there is no method call in progress, you could implement an event handler and notify client of this exception. Just back from work so can't think of any more solutions :( Let me know if this helps.
Sohail
-
Nathan, Usually, Exceptions in COM server shouldn't bubble up. Since it's an inproc server, aborting would terminate your client application. I don't know any solution that I have implemented but does any of the following help you device a framework - 1. Supporting ISupportErrorInfo for rich error information and your methods could fail with some HRESULT. Client is expected to take necessary action. 2. Not a good one, but if these are internal error and assuming there is no method call in progress, you could implement an event handler and notify client of this exception. Just back from work so can't think of any more solutions :( Let me know if this helps.
Sohail
Thanks! That's about what I thought. From what I've read, E_UNEXPECTED is intended for that sort of thing. Nathan
-
Thanks! That's about what I thought. From what I've read, E_UNEXPECTED is intended for that sort of thing. Nathan