I am having to use some old legacy code which throws HRESULTS. How do I catch these exceptions? What is the catch parameter for it?
Printable View
I am having to use some old legacy code which throws HRESULTS. How do I catch these exceptions? What is the catch parameter for it?
catch(HRESULT hr)
You should post the smallest possible compilable example that exhibits the problem, then.
Are you sure that they are throwing a HRESULT and not an exception like wrapper like _com_error or CAtlException?
If it's using something like this:then it is the kind of thing I use every day at work.Code:HRESULT hr = E_FAIL;
_com_issue_error(hr)
You should catch it like this:Code:catch(const _com_error &e)
You may be having an issue related to threading or a non-local stack.
Where is the exception being thrown from? Where are you trying to catch it?
Soma