From 2bbcff613a2352b0da76230439348ec0eb43d46f Mon Sep 17 00:00:00 2001 From: peter Date: Tue, 24 Jan 2017 20:48:09 +0100 Subject: [PATCH] print LogEventException attachments in tests --- .../com/intellij/diagnostic/LogEventException.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/platform/platform-impl/src/com/intellij/diagnostic/LogEventException.java b/platform/platform-impl/src/com/intellij/diagnostic/LogEventException.java index df36f7069357..86678704d98e 100644 --- a/platform/platform-impl/src/com/intellij/diagnostic/LogEventException.java +++ b/platform/platform-impl/src/com/intellij/diagnostic/LogEventException.java @@ -16,13 +16,15 @@ package com.intellij.diagnostic; import com.intellij.openapi.diagnostic.Attachment; +import com.intellij.openapi.diagnostic.ExceptionWithAttachments; import com.intellij.openapi.diagnostic.IdeaLoggingEvent; import com.intellij.psi.impl.DebugUtil; +import org.jetbrains.annotations.NotNull; /** * @author peter */ -public class LogEventException extends RuntimeException { +public class LogEventException extends RuntimeException implements ExceptionWithAttachments { private final IdeaLoggingEvent myLogMessage; public LogEventException(String userMessage, final String details, final Attachment... attachments) { @@ -37,4 +39,14 @@ public class LogEventException extends RuntimeException { public IdeaLoggingEvent getLogMessage() { return myLogMessage; } + + @NotNull + @Override + public Attachment[] getAttachments() { + Object data = myLogMessage.getData(); + if (data instanceof LogMessageEx) { + return ((LogMessageEx)data).getAllAttachments().toArray(Attachment.EMPTY_ARRAY); + } + return Attachment.EMPTY_ARRAY; + } }