Debugger: log error with attachments
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user