-
Notifications
You must be signed in to change notification settings - Fork 947
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
Enhance
: Use unordered_map for CURL error mapping
#1142
Conversation
Like I already said, I am not quite sure how to proceed with the clang-tidy warning. |
This is due to an updated version of clang-tidy. I fixed it in this PR: #1144 Once merged, you can rebase onto the latest master. Regarding |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome. Looks good! Please reabase onto: #1144
I hope I rebased it the right way... ;P |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for rebasing, but something went wrong there. You now also include the commits from my MR. This should not be the case.
How did you rebase?
The normal workflow for this would be:
- Add the original repo (this one) as e.g.
forkOrigin
. - Rebase onto
forkOrigin/master
. git push --force-with-lease
PS: Top check which symbols are available in which curl version: https://github.com/curl/curl/blob/master/docs/libcurl/symbols-in-versions
cpr/error.cpp
Outdated
#include <cstdint> | ||
#include <curl/curl.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess you are missing those two includes for clang-tidy to work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I removed them because there was no apparant reason for them.
I will add them back, but why does clang-tidy need them?
f761d6c
to
330725b
Compare
330725b
to
8b0ccd2
Compare
Did the cleanup. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! LGTM!
Here is the corresponding PR which should close #1140, regarding some enhancements to the error handling in cpr.
I replaced the switch-case statement used for CURL error mapping with an
unordered_map
.When using clang-tidy I am warned that the
initialization of 'curl_error_map' with static storage duration may throw an exception that cannot be caught
.I am unsure how we want to solve this:
// NOLINT
(I don't like that)The first solution would probably look something like this:
and then call this function in the
Error::getErrorCodeForCurlError
.Are there any other options you would suggest?
Also, I wasn't sure for which error codes we include version checking (and how to find out when they were released), but I could find some mentions of
PARTIAL_FILE
in some changelogs in early 2003, so I didn't add any checks for that.