Skip to content

Improve Windows Platform system error messages#8063

Merged
RyanUnderhill merged 1 commit intomasterfrom
ryanunderhill/shared_provider_error_messages
Jun 16, 2021
Merged

Improve Windows Platform system error messages#8063
RyanUnderhill merged 1 commit intomasterfrom
ryanunderhill/shared_provider_error_messages

Conversation

@RyanUnderhill
Copy link
Copy Markdown
Contributor

Description: Changes the WIndows platform error messages from things like this:

"2021-06-09 18:24:21.8575539 [E:onnxruntime:Default, provider_bridge_ort.cc:1000 onnxruntime::ProviderLibrary::Get] Failed to load library, error code: 126"

To this:

2021-06-09 18:54:17.7950730 [E:onnxruntime:Default, provider_bridge_ort.cc:1000 onnxruntime::ProviderLibrary::Get] LoadLibrary failed with error 126 "The specified module could not be found." when trying to load "C:\Code\Github\onnxruntime\build\Windows\Debug\Debug\onnxruntime\capi\onnxruntime_providers_cuda.dll"

It uses the system error messages to get the text, so it's nothing hardcoded. It will work for every error code the system has a description for.

Motivation and Context
The error messages are cryptic and minimal, this will save people a lot of time and confusion.

@RyanUnderhill RyanUnderhill requested a review from a team as a code owner June 15, 2021 23:14
const int err = GetLastError();
return ORT_MAKE_STATUS(ONNXRUNTIME, FAIL, "open file ", ToMBString(file_path), " fail, errcode = ", err);
const auto error_code = GetLastError();
return ORT_MAKE_STATUS(ONNXRUNTIME, FAIL, "open file ", ToMBString(file_path), " fail, errcode = ", error_code, " - ", std::system_category().message(error_code));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly, I don't know how "std::system_category().message()" works. I thought we need to get a handle of "ntdll.dll" then get the error message from it. But your solution is much simpler.

@RyanUnderhill RyanUnderhill merged commit 0ebaa71 into master Jun 16, 2021
@RyanUnderhill RyanUnderhill deleted the ryanunderhill/shared_provider_error_messages branch June 16, 2021 05:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants