void DebugUncaughtExceptionHandler::handle(const Exception& ex) const {
    StringBuffer buf;
    buf << "Uncaught Exception: "<<ex.name()<<": "<<ex.what()<<'\n';
    if(ex.tracemsg != null) {
        buf << "Trace messages: \n";
        Exception::TraceMessage * msg = ex.tracemsg;
        do {
            buf << "    " << String(msg->message) << '\n';
        } while((msg->next != null) && (msg = msg->next));
    }
    thisapp->fail(buf, ex._file, ex._line, false);
}
예제 #2
0
void writeException(const Exception & e, WriteBuffer & buf, bool with_stack_trace)
{
    writeBinary(e.code(), buf);
    writeBinary(String(e.name()), buf);
    writeBinary(e.displayText(), buf);

    if (with_stack_trace)
        writeBinary(e.getStackTrace().toString(), buf);
    else
        writeBinary(String(), buf);

    bool has_nested = e.nested() != nullptr;
    writeBinary(has_nested, buf);

    if (has_nested)
        writeException(Exception(Exception::CreateFromPoco, *e.nested()), buf, with_stack_trace);
}