diff options
author | Thiago Marcos P. Santos <thiago@mapbox.com> | 2015-05-19 01:13:46 +0300 |
---|---|---|
committer | Thiago Marcos P. Santos <thiago@mapbox.com> | 2015-05-22 10:44:18 +0300 |
commit | da81211feaffd89319330774b61b261b939dde33 (patch) | |
tree | 18a26cabee3d486f7684590c7b9d981c39661f4f /bin | |
parent | b304b20073556d442764696dbe5ac09d5462ada0 (diff) | |
download | qtlocation-mapboxgl-da81211feaffd89319330774b61b261b939dde33.tar.gz |
Add callback for error notifications on renderStill()
The callback will be called when any of the resources requested
from the network failed to load.
There is not recovery implemented yet, so the closest thing to
reseting the Map object and reloading all the resources would
be setting a new style.
Diffstat (limited to 'bin')
-rw-r--r-- | bin/render.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/bin/render.cpp b/bin/render.cpp index 33e216f52a..740d3dffe5 100644 --- a/bin/render.cpp +++ b/bin/render.cpp @@ -111,7 +111,16 @@ int main(int argc, char *argv[]) { util::write_file(output, png); }); - map.renderStill([async](std::unique_ptr<const StillImage> image) { + map.renderStill([async](std::exception_ptr error, std::unique_ptr<const StillImage> image) { + try { + if (error) { + std::rethrow_exception(error); + } + } catch(std::exception& e) { + std::cout << "Error: " << e.what() << std::endl; + exit(1); + } + async->data = const_cast<StillImage *>(image.release()); uv_async_send(async); }); |