예제 #1
0
std::string getExceptionMessage(const Exception & e, bool with_stacktrace, bool check_embedded_stacktrace)
{
    std::stringstream stream;

    try
    {
        std::string text = e.displayText();

        bool has_embedded_stack_trace = false;
        if (check_embedded_stacktrace)
        {
            auto embedded_stack_trace_pos = text.find("Stack trace");
            has_embedded_stack_trace = embedded_stack_trace_pos != std::string::npos;
            if (!with_stacktrace && has_embedded_stack_trace)
            {
                text.resize(embedded_stack_trace_pos);
                Poco::trimRightInPlace(text);
            }
        }

        stream << "Code: " << e.code() << ", e.displayText() = " << text;

        if (with_stacktrace && !has_embedded_stack_trace)
            stream << ", Stack trace:\n\n" << e.getStackTrace().toString();
    }
    catch (...) {}

    return stream.str();
}
예제 #2
0
void kdrive::connector::raiseError(Connector& connector, const Exception& exception)
{
	const int errorCode = exception.code() ? exception.code() : ConnectorErrorCodes::ConnectorError;

	connector.setLastErrorCode(errorCode);
	connector.setLastErrorMessage(exception.displayText());
	connector.routeEvent(ConnectorEvents::Error);
	exception.rethrow();
}
예제 #3
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);
}
예제 #4
0
파일: Logger.cpp 프로젝트: Denisss025/poco
void Logger::log(const Exception& exc, const char* file, int line)
{
	error(exc.displayText(), file, line);
}
예제 #5
0
파일: Logger.cpp 프로젝트: Denisss025/poco
void Logger::log(const Exception& exc)
{
	error(exc.displayText());
}