mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-24 19:43:35 +00:00
Make ort errors appear in winml exceptions (#3316)
Co-authored-by: Sheil Kumar <sheilk@microsoft.com>
This commit is contained in:
parent
4db01309cb
commit
51e95ea946
2 changed files with 7 additions and 6 deletions
|
|
@ -46,8 +46,9 @@ inline HRESULT OrtErrorCodeToHRESULT(OrtErrorCode status) noexcept {
|
|||
auto error_message = ort_api->GetErrorMessage(_status); \
|
||||
HRESULT hresult = OrtErrorCodeToHRESULT(error_code); \
|
||||
telemetry_helper.LogRuntimeError(hresult, std::string(error_message), __FILE__, __FUNCTION__, __LINE__); \
|
||||
RETURN_HR_MSG(hresult, \
|
||||
error_message); \
|
||||
auto message = WinML::Strings::HStringFromUTF8(error_message); \
|
||||
RoOriginateError(hresult, reinterpret_cast<HSTRING>(winrt::get_abi(message))); \
|
||||
return hresult; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
|
@ -59,7 +60,7 @@ inline HRESULT OrtErrorCodeToHRESULT(OrtErrorCode status) noexcept {
|
|||
auto error_message = ort_api->GetErrorMessage(_status); \
|
||||
HRESULT hresult = OrtErrorCodeToHRESULT(error_code); \
|
||||
telemetry_helper.LogRuntimeError(hresult, std::string(error_message), __FILE__, __FUNCTION__, __LINE__); \
|
||||
winrt::hstring errorMessage(WinML::Strings::HStringFromUTF8(error_message)); \
|
||||
throw winrt::hresult_error(hresult, errorMessage); \
|
||||
auto message = WinML::Strings::HStringFromUTF8(error_message); \
|
||||
throw winrt::hresult_error(hresult, message); \
|
||||
} \
|
||||
} while (0)
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@
|
|||
{ \
|
||||
auto _result = hr; \
|
||||
telemetry_helper.LogRuntimeError(_result, "", __FILE__, __FUNCTION__, __LINE__); \
|
||||
throw winrt::hresult_error(_result); \
|
||||
throw winrt::hresult_error(_result, winrt::hresult_error::from_abi); \
|
||||
}
|
||||
|
||||
#define WINML_THROW_IF_FAILED(hr) \
|
||||
|
|
@ -52,7 +52,7 @@
|
|||
HRESULT _hr = hr; \
|
||||
if (FAILED(_hr)) { \
|
||||
telemetry_helper.LogRuntimeError(_hr, "", __FILE__, __FUNCTION__, __LINE__); \
|
||||
throw winrt::hresult_error(_hr); \
|
||||
throw winrt::hresult_error(_hr, winrt::hresult_error::from_abi); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue