10 #ifdef __BACKTRACE_ON__
25 std::stringstream errstr;
26 errstr <<
"Abort: "<<std::endl
27 <<
"Q> Exception: QError" << std::endl
28 <<
"Q> Code : " << (int)
err.GetCode()
29 <<
" (" <<
err.ToString() <<
")";
30 if(
"" !=
err.GetDescription()) {
31 errstr << std::endl<<
"Q> Descr : " <<
err.GetDescription();
33 std::cerr<<errstr.str()<<std::endl;
35 std::cerr << std::flush;
41 std::stringstream errstr;
42 errstr <<
"Abort: "<<std::endl
43 <<
"Q> Exception: " << ex.what();
44 std::cerr<<errstr.str()<<std::endl;
46 std::cerr << std::flush;
50 void Abort(
const std::string& str)
52 std::stringstream errstr;
53 errstr <<
"Abort: "<<std::endl
54 <<
"Q> Exception: " << str;
55 std::cerr<<errstr.str()<<std::endl;
57 std::cerr << std::flush;
63 std::stringstream errstr;
64 errstr <<
"Error: "<<std::endl
65 <<
"Q> Exception: Unknown type";
66 std::cerr<<errstr.str()<<std::endl;
68 std::cerr << std::flush;
75 #ifdef __BACKTRACE_ON__
76 FILE *tmpFile=tmpfile();
77 int save_stderr=dup(fileno(stderr));
78 dup2(fileno(tmpFile),fileno(stderr));
79 gSystem->StackTrace();
80 dup2(save_stderr,STDERR_FILENO);
86 ioctl(0, TIOCGWINSZ, &w);
88 if (NCol < 18) NCol = 18;
89 o <<
"\n" << std::string((NCol-18)/2,
'-') <<
" DIANA Backtrace: "
90 << std::string((NCol-18)/2,
'-') << std::endl;
91 while(!feof(tmpFile)){
92 char c=fgetc(tmpFile);
96 o << std::string((NCol-18)/2,
'-') <<
" Finish Backtrace "
97 << std::string((NCol-18)/2,
'-') << std::endl;
void diana_stacktrace(std::ostream &o, size_t MaxLines)
error class with error type and description
the Diana namespace is needed because sometimes we use Qt libraries, that use same class names of our...
void Abort(const QError &err)
void SetDianaDebug(bool value)