Add special handling for util::exception in various places to print stacktrace info
This commit is contained in:
parent
1c22892eec
commit
dd12ad9477
3 changed files with 18 additions and 0 deletions
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include <psemek/util/unused.hpp>
|
||||
#include <psemek/util/to_string.hpp>
|
||||
#include <psemek/util/exception.hpp>
|
||||
|
||||
#include <psemek/log/log.hpp>
|
||||
|
||||
|
|
@ -41,6 +42,10 @@ namespace psemek::async
|
|||
{
|
||||
running = false;
|
||||
}
|
||||
catch (util::exception const & e)
|
||||
{
|
||||
log::error() << "Unhandled exception in threadpool executor: " << e;
|
||||
}
|
||||
catch (std::exception const & e)
|
||||
{
|
||||
log::error() << "Unhandled exception in threadpool executor: " << e.what();
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
#include <psemek/util/clock.hpp>
|
||||
#include <psemek/util/pretty_print.hpp>
|
||||
#include <psemek/log/log.hpp>
|
||||
#include <psemek/util/exception.hpp>
|
||||
|
||||
#undef main
|
||||
|
||||
|
|
@ -62,6 +63,11 @@ int main(int argc, char ** argv) try
|
|||
log::info() << "Quitting";
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
catch (psemek::util::exception const & e)
|
||||
{
|
||||
psemek::log::error() << e;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
catch (std::exception const & e)
|
||||
{
|
||||
psemek::log::error() << e.what();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
#include <psemek/test/test.hpp>
|
||||
#include <psemek/util/pretty_print.hpp>
|
||||
#include <psemek/util/exception.hpp>
|
||||
#include <psemek/log/log.hpp>
|
||||
|
||||
#include <map>
|
||||
|
|
@ -176,6 +177,12 @@ int main(int argc, char ** argv)
|
|||
std::cout << indent << "Reason: " << yellow << e.message() << normal << std::endl;
|
||||
std::cout << indent << "Location: " << cyan << e.location() << normal << std::endl;
|
||||
}
|
||||
catch (psemek::util::exception const & e)
|
||||
{
|
||||
auto end = clock::now();
|
||||
std::cout << red << "failure: " << e.what() << normal << " " << psemek::util::pretty(end - start, std::chrono::milliseconds{1}) << std::endl;
|
||||
std::cout << red << e.stacktrace();
|
||||
}
|
||||
catch (std::exception const & e)
|
||||
{
|
||||
auto end = clock::now();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue