[core] move retry logic to DefaultFileSource

This commit is contained in:
Konstantin Käfer
2015-11-02 16:14:41 +01:00
parent 52558acde8
commit 4d5c6333be
39 changed files with 609 additions and 623 deletions

View File

@@ -112,14 +112,17 @@ void MapContext::setStyleURL(const std::string& url) {
}
styleRequest = nullptr;
if (res.status == Response::Successful) {
loadStyleJSON(*res.data, base);
} else if (res.status == Response::NotFound && styleURL.find("mapbox://") == 0) {
Log::Error(Event::Setup, "style %s could not be found or is an incompatible legacy map or style", styleURL.c_str());
if (res.error) {
if (res.error->reason == Response::Error::Reason::NotFound && styleURL.find("mapbox://") == 0) {
Log::Error(Event::Setup, "style %s could not be found or is an incompatible legacy map or style", styleURL.c_str());
} else {
Log::Error(Event::Setup, "loading style failed: %s", res.error->message.c_str());
data.loading = false;
}
} else {
Log::Error(Event::Setup, "loading style failed: %s", res.message.c_str());
data.loading = false;
loadStyleJSON(*res.data, base);
}
});
}