Log stacktrace instead of writing to stderr

This commit is contained in:
Peter Conrad 2019-09-17 16:11:09 +02:00
parent 4ce3775630
commit 9077892d87

View file

@ -7,7 +7,7 @@
#include <boost/thread.hpp>
#include <boost/atomic.hpp>
#include <iostream>
#include <sstream>
#include <vector>
namespace fc {
@ -394,8 +394,10 @@ namespace fc {
* is probably just as likely to cause crashes */
if( std::current_exception() != std::exception_ptr() )
{
elog( "Thread ${name} yielded in exception handler!", ("name",thread::current().name()) );
print_stacktrace( std::cerr );
std::stringstream stacktrace;
print_stacktrace( stacktrace );
elog( "Thread ${name} yielded in exception handler!\n${trace}",
("name",thread::current().name())("trace",stacktrace.str()) );
assert( std::current_exception() != std::exception_ptr() );
}