[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:
John Firebaugh
2015-12-22 15:10:24 -08:00
parent 7bd4745cf1
commit 16de579d7c
28 changed files with 405 additions and 472 deletions

View File

@@ -1,5 +1,6 @@
#include <mbgl/map/tile_data.hpp>
#include <mbgl/renderer/debug_bucket.hpp>
#include <mbgl/util/string.hpp>
namespace mbgl {
@@ -26,7 +27,10 @@ const char* TileData::StateToString(const State state) {
void TileData::dumpDebugLogs() const {
Log::Info(Event::General, "TileData::id: %s", std::string(id).c_str());
Log::Info(Event::General, "TileData::state: %s", TileData::StateToString(state));
Log::Info(Event::General, "TileData::error: %s", error.c_str());
if (error) {
Log::Info(Event::General, "TileData::error: %s", util::toString(error).c_str());
}
}
} // namespace mbgl