util/PrintException: support "const char *"

This commit is contained in:
Max Kellermann 2019-01-21 21:19:35 +01:00
parent 424f75c9e1
commit b02fee7309
1 changed files with 4 additions and 0 deletions

View File

@ -42,6 +42,8 @@ PrintException(const std::exception &e) noexcept
std::rethrow_if_nested(e);
} catch (const std::exception &nested) {
PrintException(nested);
} catch (const char *s) {
fprintf(stderr, "%s\n", s);
} catch (...) {
fprintf(stderr, "Unrecognized nested exception\n");
}
@ -54,6 +56,8 @@ PrintException(const std::exception_ptr &ep) noexcept
std::rethrow_exception(ep);
} catch (const std::exception &e) {
PrintException(e);
} catch (const char *s) {
fprintf(stderr, "%s\n", s);
} catch (...) {
fprintf(stderr, "Unrecognized exception\n");
}