Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

redfishpower: output more detailed error messages #183

Merged
merged 1 commit into from
Apr 27, 2024

Conversation

chu11
Copy link
Member

@chu11 chu11 commented Apr 27, 2024

Problem: Redfishpower decided to output a generic "network error" message when either a connection error occurred (i.e. typically if the host is down) vs a operation timeout (i.e. such as a failed DNS lookup). It would be useful to know which one actually happened.

Split the "network error" message into two specific error messages.

Comment on lines 1592 to 1595
if (cmsg->data.result == CURLE_COULDNT_CONNECT)
printf("%s: %s\n", pm->plugname, "couldn't connect");
else if (cmsg->data.result == CURLE_OPERATION_TIMEDOUT)
printf("%s: %s\n", pm->plugname, "operation timedout");
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Ahhh good idea, although b/c this is CURLcode not CURLMcode

https://curl.se/libcurl/c/curl_multi_info_read.html

we gotta use a slightly different function.

Problem: Redfishpower decided to output a generic "network error"
message when either a connection error occurred (i.e. typically
if the host is down) vs a operation timeout (i.e. such as a failed
DNS lookup).  All other errors are generically output as "error".
It would be useful to know which one actually happened.

Call curl_easy_strerror() on the error, to get the appropriate
error message for the error code.
@chu11 chu11 force-pushed the redfishpower_error_messages branch from fd85cbe to 2946b1e Compare April 27, 2024 03:52
@chu11 chu11 changed the title redfishpower: make network error messages clearer redfishpower: output more detailed error messages Apr 27, 2024
@chu11
Copy link
Member Author

chu11 commented Apr 27, 2024

re-pushed going with calling curl_easy_strerror

Copy link
Member

@garlick garlick left a comment

Choose a reason for hiding this comment

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

LGTM!

@mergify mergify bot merged commit 1990992 into chaos:master Apr 27, 2024
8 checks passed
@chu11 chu11 deleted the redfishpower_error_messages branch April 29, 2024 23:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants