Skip to content

TOutput: Add further parsers for errno-to-string conversion#2109

Merged
dcelasun merged 1 commit intoapache:masterfrom
BioDataAnalysis:bda_add_better_errno_print_for_win
Apr 24, 2020
Merged

TOutput: Add further parsers for errno-to-string conversion#2109
dcelasun merged 1 commit intoapache:masterfrom
BioDataAnalysis:bda_add_better_errno_print_for_win

Conversation

@emmenlau
Copy link
Copy Markdown
Member

This change has mostly an impact on Windows. Currently Thrift does not resolve error strings on Windows (for me). A typical error message may look like Could not bind: errno = 10049. With C++11 the newer formatting method strerror_s() is available on MSVC, however it fails to resolve many error messages. The most complete error handling on MSVC is possible only via Windows methods.

This PR adds support for decoding error codes on MSVC via FormatMessageA() into an ASCII string. In effect, above error id 10049 can be decoded as Could not bind: The requested address is not valid in its context.

Furthermore, on platforms that do not have strerror_r available (non-Posix systems), this PR turns to strerror_s from C++11 to decode the message.

  • Did you create an Apache Jira ticket? (not required for trivial changes)
  • If a ticket exists: Does your pull request title follow the pattern "THRIFT-NNNN: describe my issue"?
  • Did you squash your changes to a single commit? (not required, but preferred)
  • Did you do your best to avoid breaking changes? If one was needed, did you label the Jira ticket with "Breaking-Change"?
  • If your change does not involve any code, add [skip ci] at the end of your pull request to free up build resources.

@emmenlau
Copy link
Copy Markdown
Member Author

The single error in Travis CI is unrelated. Please review?

@dcelasun
Copy link
Copy Markdown
Member

Thanks for the PR @emmenlau!

I'm not familiar with Windows or MSVC but this is at least harmless for other platforms so if nobody objects, I'll go ahead and merge this in 24 hours.

Copy link
Copy Markdown
Contributor

@janosvitok janosvitok left a comment

Choose a reason for hiding this comment

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

From quick look it seems ok.

@dcelasun dcelasun merged commit 0457437 into apache:master Apr 24, 2020
@emmenlau emmenlau deleted the bda_add_better_errno_print_for_win branch April 24, 2020 16:48
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.

3 participants