summaryrefslogtreecommitdiff
path: root/src/mbgl/map/raster_tile_data.cpp
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2015-12-22 15:10:24 -0800
committerJohn Firebaugh <john.firebaugh@gmail.com>2015-12-23 12:50:42 -0800
commit16de579d7cfc2960793cbcb5e95741f22ab73768 (patch)
treeb4c3b7651f605e3d3dd61b469f61036bd2c4dcc3 /src/mbgl/map/raster_tile_data.cpp
parent7bd4745cf10c504a4899a37016e87bce45e51472 (diff)
downloadqtlocation-mapboxgl-16de579d7cfc2960793cbcb5e95741f22ab73768.tar.gz
[core] Rationalize error handling for resource loading
* Standardize on std::exception_ptr as the error representation (fixes #2854). * Don't format textual strings at the error source; pass on the constituent data via observer method parameters instead. * Use the null object pattern to simplify observer notification code. * Further refactoring for ResourceLoading tests.
Diffstat (limited to 'src/mbgl/map/raster_tile_data.cpp')
-rw-r--r--src/mbgl/map/raster_tile_data.cpp10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/mbgl/map/raster_tile_data.cpp b/src/mbgl/map/raster_tile_data.cpp
index 7ef13301e8..5c85cbd034 100644
--- a/src/mbgl/map/raster_tile_data.cpp
+++ b/src/mbgl/map/raster_tile_data.cpp
@@ -6,8 +6,6 @@
#include <mbgl/util/worker.hpp>
#include <mbgl/util/work_request.hpp>
-#include <sstream>
-
using namespace mbgl;
RasterTileData::RasterTileData(const TileID& id_,
@@ -41,9 +39,7 @@ void RasterTileData::request(float pixelRatio,
if (res.error->reason == Response::Error::Reason::NotFound) {
state = State::parsed;
} else {
- std::stringstream message;
- message << "Failed to load [" << url << "]: " << res.error->message;
- error = message.str();
+ error = std::make_exception_ptr(std::runtime_error(res.error->message));
state = State::obsolete;
}
callback();
@@ -68,9 +64,7 @@ void RasterTileData::request(float pixelRatio,
state = State::parsed;
bucket = std::move(result.get<std::unique_ptr<Bucket>>());
} else {
- std::stringstream message;
- message << "Failed to parse [" << std::string(id) << "]: " << result.get<std::string>();
- error = message.str();
+ error = result.get<std::exception_ptr>();
state = State::obsolete;
}