Debugger: Fix missing read action in error reporting
This commit is contained in:
+14
-12
@@ -426,20 +426,22 @@ private fun isSpecialException(th: Throwable): Boolean {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun reportError(codeFragment: KtCodeFragment, position: SourcePosition?, message: String, throwable: Throwable? = null) {
|
private fun reportError(codeFragment: KtCodeFragment, position: SourcePosition?, message: String, throwable: Throwable? = null) {
|
||||||
val contextFile = codeFragment.context?.containingFile
|
runReadAction {
|
||||||
|
val contextFile = codeFragment.context?.containingFile
|
||||||
|
|
||||||
val attachments = arrayOf(
|
val attachments = arrayOf(
|
||||||
attachmentByPsiFile(contextFile),
|
attachmentByPsiFile(contextFile),
|
||||||
attachmentByPsiFile(codeFragment),
|
attachmentByPsiFile(codeFragment),
|
||||||
Attachment("breakpoint.info", "Position: " + position?.run { "${file.name}:$line" }),
|
Attachment("breakpoint.info", "Position: " + position?.run { "${file.name}:$line" }),
|
||||||
Attachment("context.info", runReadAction { codeFragment.context?.text ?: "null" })
|
Attachment("context.info", runReadAction { codeFragment.context?.text ?: "null" })
|
||||||
)
|
)
|
||||||
|
|
||||||
LOG.error(
|
LOG.error(
|
||||||
"Cannot evaluate a code fragment of type " + codeFragment::class.java + ": " + message.decapitalize(),
|
"Cannot evaluate a code fragment of type " + codeFragment::class.java + ": " + message.decapitalize(),
|
||||||
throwable,
|
throwable,
|
||||||
mergeAttachments(*attachments)
|
mergeAttachments(*attachments)
|
||||||
)
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun evaluationException(msg: String): Nothing = throw EvaluateExceptionUtil.createEvaluateException(msg)
|
private fun evaluationException(msg: String): Nothing = throw EvaluateExceptionUtil.createEvaluateException(msg)
|
||||||
|
|||||||
Reference in New Issue
Block a user