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.
This commit is contained in:
Thiago Marcos P. Santos
2015-05-19 01:13:46 +03:00
parent b304b20073
commit da81211fea
9 changed files with 46 additions and 7 deletions

View File

@@ -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);
});