[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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user