diff options
author | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2020-02-27 16:47:58 +0200 |
---|---|---|
committer | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2020-02-28 12:52:26 +0200 |
commit | 3bf914307926bbf0f91ce12eadf778d2690dafe0 (patch) | |
tree | 88dde45caf10b2f40c38d13be5ee596b5229bb6d | |
parent | 91437d8101645422f608fe9ef67b2d9ea1acbcbf (diff) | |
download | qtlocation-mapboxgl-3bf914307926bbf0f91ce12eadf778d2690dafe0.tar.gz |
Emit error message with URL details on load error 404
-rw-r--r-- | platform/default/src/mbgl/storage/online_file_source.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/platform/default/src/mbgl/storage/online_file_source.cpp b/platform/default/src/mbgl/storage/online_file_source.cpp index 8aa2d225ee..f578eb1479 100644 --- a/platform/default/src/mbgl/storage/online_file_source.cpp +++ b/platform/default/src/mbgl/storage/online_file_source.cpp @@ -459,6 +459,15 @@ void OnlineFileRequest::schedule(optional<Timestamp> expires) { }); } +namespace { + +inline std::string sanitizeURL(std::string& url) { + std::size_t queryIndex = url.find('?'); + return (queryIndex != std::string::npos) ? std::string(url, 0, queryIndex) : url; +} + +} // namespace + void OnlineFileRequest::completed(Response response) { // If we didn't get various caching headers in the response, continue using the // previous values. Otherwise, update the previous values to the new values. @@ -498,6 +507,9 @@ void OnlineFileRequest::completed(Response response) { } if (response.error) { + if (response.error->reason == Response::Error::Reason::NotFound) { + Log::Error(Event::General, "The resource `%s` not found", sanitizeURL(resource.url).c_str()); + } failedRequests++; failedRequestReason = response.error->reason; retryAfter = response.error->retryAfter; |