22 #include <boost/exception/diagnostic_information.hpp> 26 this->
frames_to_cut_ = {
"boost",
"exception_detail",
"throw_exception"};
50 static std::string message(1024,
' ');
54 std::ostringstream converter;
56 converter << std::endl << std::endl;
57 converter <<
"--------------------------------------------------------" << std::endl;
61 converter <<
"\n** Diagnosting info **\n" ;
62 converter << boost::diagnostic_information_what( *
this );
64 converter <<
"--------------------------------------------------------" << std::endl;
66 message = converter.str();
67 return message.c_str();
69 }
catch (std::exception &exc) {
70 std::cerr <<
"*** Exception encountered in exception handling routines ***" << std::endl <<
"*** Message is " << std::endl
71 << exc.what() << std::endl <<
"*** Aborting! ***" << std::endl;
75 std::cerr <<
"*** Exception encountered in exception handling routines ***" << std::endl <<
"*** Aborting! ***" 85 return "Program Error: ";
virtual const char * what() const
ExceptionBase()
Default constructor, just calls fill_stacktrace().
void print(std::ostream &out, std::vector< std::string > frames_to_cut=std::vector< std::string >()) const
Prints formated stacktrace into given stream out.
StackTrace stack_trace_
Stacktrace of exception.
std::vector< std::string > frames_to_cut_
Stacktrace frames, which will be cut, see StackTrace::print method.
virtual std::string what_type_msg() const
Return type of message ("Program error" for this class). Can be override in descendants.
virtual void print_info(std::ostringstream &out) const =0
virtual ~ExceptionBase()
Destructor, possibly free stacktrace.
Base of exceptions used in Flow123d.
void print_stacktrace(std::ostream &out) const
Prints formated stacktrace into given stream out.