From 6d7cab0335a6b3864370c7722e2eb6e552401a34 Mon Sep 17 00:00:00 2001 From: Natalia Ukhorskaya Date: Wed, 11 Mar 2015 11:57:14 +0300 Subject: [PATCH] Debugger: log error with attachments --- .../idea/debugger/evaluate/KotlinEvaluationBuilder.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/idea/src/org/jetbrains/kotlin/idea/debugger/evaluate/KotlinEvaluationBuilder.kt b/idea/src/org/jetbrains/kotlin/idea/debugger/evaluate/KotlinEvaluationBuilder.kt index 59c9daf444d..7bd660fe45f 100644 --- a/idea/src/org/jetbrains/kotlin/idea/debugger/evaluate/KotlinEvaluationBuilder.kt +++ b/idea/src/org/jetbrains/kotlin/idea/debugger/evaluate/KotlinEvaluationBuilder.kt @@ -32,6 +32,7 @@ import com.intellij.psi.PsiFileFactory import com.intellij.psi.impl.PsiFileFactoryImpl import com.intellij.psi.search.GlobalSearchScope import com.intellij.testFramework.LightVirtualFile +import com.intellij.util.ExceptionUtil import com.sun.jdi.* import com.sun.jdi.request.EventRequest import org.jetbrains.eval4j.* @@ -134,11 +135,10 @@ class KotlinEvaluator(val codeFragment: JetCodeFragment, throw e } catch (e: Exception) { - logger.error("Couldn't evaluate expression:\n" + - "FILE NAME: ${sourcePosition.getFile().getName()}\n" + - "BREAKPOINT LINE: ${sourcePosition.getLine()}\n" + - "CODE FRAGMENT:\n${codeFragment.getText()}\n" + - "FILE TEXT: \n${sourcePosition.getFile().getText()}\n", e) + val attachments = array(attachmentByPsiFile(sourcePosition.getFile()), + attachmentByPsiFile(codeFragment), + Attachment("breakpoint.info", "line: ${sourcePosition.getLine()}")) + logger.error("Couldn't evaluate expression:\n" + ExceptionUtil.getThrowableText(e), mergeAttachments(*attachments)) val cause = if (e.getMessage() != null) ": ${e.getMessage()}" else "" exception("An exception occurs during Evaluate Expression Action $cause")