diff options
Diffstat (limited to 'include/mbgl/util/string.hpp')
-rw-r--r-- | include/mbgl/util/string.hpp | 9 |
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) { |