저는 Windows 8 앱 (C++)을 작업하고 있습니다. Windows 8 샘플 컬렉션의 httpclient 클래스를 사용했습니다.예외를 잡는 방법 [C++/CX]
inline void CheckHResult(HRESULT hResult)
{
if (hResult == E_ABORT)
{
concurrency::cancel_current_task();
}
else if (FAILED(hResult))
{
throw Platform::Exception::CreateException(hResult);
}
}
이 함수는 앱이 인터넷에 연결되어 있지 않을 때 예외를 throw합니다. 나는 이런 람다에서 예외를 잡으려고 노력하고있다.
return completionTask.then([this, stringCallback](tuple<HRESULT, wstring> resultTuple)
{
try
{
CheckHResult(std::get<0>(resultTuple));
}
catch(Exception^ ex)
{
}
return std::get<1>(resultTuple);
});
하지만 여전히 처리되지 않은 예외 보여주고있다 :
First-chance exception at 0x77194B32 in Sample.exe: Microsoft C++ exception: Platform::COMException^at memory location 0x08C7EDF4. HRESULT:0x800C0005
If there is a handler for this exception, the program may be safely continued.
내가 잘못하고있는 중이 있나요를?
도움을 주셔서 감사합니다. 너 같은 지식있는 사람들에게서 배우는 것이 좋다. :) –