Search in sources :

Example 1 with ExceptionWithAttachments

use of com.intellij.openapi.diagnostic.ExceptionWithAttachments in project intellij-community by JetBrains.

the class DialogAppender method extractLoggingEvent.

private static IdeaLoggingEvent extractLoggingEvent(Object message, Throwable throwable) {
    //noinspection ThrowableResultOfMethodCallIgnored
    Throwable rootCause = ExceptionUtil.getRootCause(throwable);
    if (rootCause instanceof LogEventException) {
        return ((LogEventException) rootCause).getLogMessage();
    }
    String strMessage = message == null ? "<null> " : message.toString();
    ExceptionWithAttachments withAttachments = ExceptionUtil.findCause(throwable, ExceptionWithAttachments.class);
    if (withAttachments != null) {
        return LogMessageEx.createEvent(strMessage, ExceptionUtil.getThrowableText(throwable), withAttachments.getAttachments());
    }
    return new IdeaLoggingEvent(strMessage, throwable);
}
Also used : ExceptionWithAttachments(com.intellij.openapi.diagnostic.ExceptionWithAttachments) IdeaLoggingEvent(com.intellij.openapi.diagnostic.IdeaLoggingEvent)

Aggregations

ExceptionWithAttachments (com.intellij.openapi.diagnostic.ExceptionWithAttachments)1 IdeaLoggingEvent (com.intellij.openapi.diagnostic.IdeaLoggingEvent)1