[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.
This commit is contained in:
@@ -311,16 +311,13 @@ void MapContext::onLowMemory() {
|
||||
style->onLowMemory();
|
||||
asyncInvalidate.send();
|
||||
}
|
||||
|
||||
void MapContext::onTileDataChanged() {
|
||||
assert(util::ThreadContext::currentlyOn(util::ThreadType::Map));
|
||||
|
||||
void MapContext::onResourceLoaded() {
|
||||
updateFlags |= Update::Repaint;
|
||||
asyncUpdate.send();
|
||||
}
|
||||
|
||||
void MapContext::onResourceLoadingFailed(std::exception_ptr error) {
|
||||
assert(util::ThreadContext::currentlyOn(util::ThreadType::Map));
|
||||
|
||||
void MapContext::onResourceError(std::exception_ptr error) {
|
||||
if (data.mode == MapMode::Still && callback) {
|
||||
callback(error, {});
|
||||
callback = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user