[core] Assert and guard against null std::exception_ptr in toString

We don't expect toString to be called with a null std::exception_ptr. But if it is, we'd prefer not to terminate the process in release builds.
This commit is contained in:
John Firebaugh
2016-03-15 12:45:07 -07:00
parent 4c455f4053
commit 46830f1ea5

View File

@@ -28,6 +28,12 @@ inline std::string toString(uint8_t num) {
}
inline std::string toString(std::exception_ptr error) {
assert(error);
if (!error) {
return "(null)";
}
try {
std::rethrow_exception(error);
} catch (const std::exception& ex) {