Skip to content

Commit

Permalink
Improve error output while encountering API errors
Browse files Browse the repository at this point in the history
  • Loading branch information
fboes committed Nov 25, 2019
1 parent 1cc5949 commit 8abe0bf
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/WettergeraetLib/FetchUrl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@ std::string FetchUrl::fetch(std::string url, unsigned short fetchMode, std::stri
long response_code;
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &response_code);

if (response_code == 403) {
if (response_code == 400) {
throw std::invalid_argument("Wrong request (e.g. unrecognized airport) encountered while calling " + url);
}
else if (response_code == 401 || response_code == 402 || response_code == 403) {
throw std::invalid_argument("Missing or invalid API key supplied for " + url);
}
else if (response_code == 404) {
Expand Down

0 comments on commit 8abe0bf

Please sign in to comment.