Question

I'm writing a COM object that provides access to a service that must be explicitly connected before calls can succeed.

Is there a generic HRESULT code that describes that the callee object is in a state where it is unprepared to handle calls, ideally with the implication that this is the caller's fault?

Currently I'm using E_FAIL, which is too generic for my taste; OLE_E_BLANK might be an option, however this is not an OLE object and I'd rather not return a confusing error code.

Was it helpful?

Solution

I would suggest that E_NOT_VALID_STATE would be closest to what you want to convey. But, as Hans says, implement IErrorInfo to give chapter and verse.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top