Improve Windows Platform system error messages#8063
Merged
RyanUnderhill merged 1 commit intomasterfrom Jun 16, 2021
Merged
Conversation
snnn
reviewed
Jun 15, 2021
| 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)); |
Contributor
There was a problem hiding this comment.
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.
snnn
approved these changes
Jun 15, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.