Skip to content

Commit

Permalink
redfishpower: make network error messages clearer
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
chu11 committed Apr 27, 2024
1 parent 2d601c1 commit fd85cbe
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/redfishpower/redfishpower.c
Original file line number Diff line number Diff line change
Expand Up @@ -1589,9 +1589,10 @@ static void shell(CURLM *mh)
err_exit(false, "private data not set in easy handle");

if (cmsg->data.result != 0) {
if (cmsg->data.result == CURLE_COULDNT_CONNECT
|| cmsg->data.result == CURLE_OPERATION_TIMEDOUT)
printf("%s: %s\n", pm->plugname, "network error");
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");
else if (cmsg->data.result == CURLE_HTTP_RETURNED_ERROR) {
/* N.B. curl returns this error code for all response
* codes >= 400. So gotta dig in more.
Expand Down

0 comments on commit fd85cbe

Please sign in to comment.