summaryrefslogtreecommitdiff
path: root/include/mbgl/util/string.hpp
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2015-12-22 16:32:25 -0800
committerJohn Firebaugh <john.firebaugh@gmail.com>2015-12-22 18:00:30 -0800
commit7c22792bdfa1f89990736bd8ef67cb4e5e64220f (patch)
tree855bf1ba6ef29c53ddb699863b07156407677c1b /include/mbgl/util/string.hpp
parentd745ff09235cfb62404f56fb6403fa093fa9a92c (diff)
downloadqtlocation-mapboxgl-7c22792bdfa1f89990736bd8ef67cb4e5e64220f.tar.gz
[tests] Rewrite resource loading test
Make it more readable and easier to debug.
Diffstat (limited to 'include/mbgl/util/string.hpp')
-rw-r--r--include/mbgl/util/string.hpp9
1 files changed, 9 insertions, 0 deletions
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) {