diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2015-12-22 16:32:25 -0800 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2015-12-22 18:00:30 -0800 |
commit | 7c22792bdfa1f89990736bd8ef67cb4e5e64220f (patch) | |
tree | 855bf1ba6ef29c53ddb699863b07156407677c1b /include | |
parent | d745ff09235cfb62404f56fb6403fa093fa9a92c (diff) | |
download | qtlocation-mapboxgl-7c22792bdfa1f89990736bd8ef67cb4e5e64220f.tar.gz |
[tests] Rewrite resource loading test
Make it more readable and easier to debug.
Diffstat (limited to 'include')
-rw-r--r-- | include/mbgl/platform/log.hpp | 6 | ||||
-rw-r--r-- | include/mbgl/util/string.hpp | 9 |
2 files changed, 15 insertions, 0 deletions
diff --git a/include/mbgl/platform/log.hpp b/include/mbgl/platform/log.hpp index a2a9119905..cd072c37da 100644 --- a/include/mbgl/platform/log.hpp +++ b/include/mbgl/platform/log.hpp @@ -21,6 +21,12 @@ public: virtual bool onRecord(EventSeverity severity, Event event, int64_t code, const std::string &msg) = 0; }; + class NullObserver : public Observer { + bool onRecord(EventSeverity, Event, int64_t, const std::string&) override { + return true; + } + }; + static void setObserver(std::unique_ptr<Observer> Observer); static std::unique_ptr<Observer> removeObserver(); diff --git a/include/mbgl/util/string.hpp b/include/mbgl/util/string.hpp index 9e2b2d8819..bc6b3b1eff 100644 --- a/include/mbgl/util/string.hpp +++ b/include/mbgl/util/string.hpp @@ -22,6 +22,15 @@ inline std::string toString(int8_t num) { return boost::lexical_cast<std::string>(int(num)); } +inline std::string toString(std::exception_ptr error) { + try { + std::rethrow_exception(error); + } catch (const std::exception& ex) { + return ex.what(); + } catch (...) { + return "Unknown exception type"; + } +} template<size_t max, typename... Args> inline std::string sprintf(const char *msg, Args... args) { |