Debugger: add tmp file to exception report

This commit is contained in:
Natalia Ukhorskaya
2015-08-20 13:21:58 +03:00
parent 73099c3a41
commit 35cb23ffbe
@@ -42,13 +42,14 @@ fun getFunctionForExtractedFragment(
breakpointLine: Int breakpointLine: Int
): ExtractionResult? { ): ExtractionResult? {
fun getErrorMessageForExtractFunctionResult(analysisResult: AnalysisResult): String { fun getErrorMessageForExtractFunctionResult(analysisResult: AnalysisResult, tmpFile: JetFile): String {
if (KotlinInternalMode.enabled) { if (KotlinInternalMode.enabled) {
logger.error("Couldn't extract function for debugger:\n" + logger.error("Couldn't extract function for debugger:\n" +
"FILE NAME: ${breakpointFile.getName()}\n" + "FILE NAME: ${breakpointFile.getName()}\n" +
"BREAKPOINT LINE: ${breakpointLine}\n" + "BREAKPOINT LINE: ${breakpointLine}\n" +
"CODE FRAGMENT:\n${codeFragment.getText()}\n" + "CODE FRAGMENT:\n${codeFragment.getText()}\n" +
"ERRORS:\n${analysisResult.messages.map { "$it: ${it.renderMessage()}" }.joinToString("\n")}\n" + "ERRORS:\n${analysisResult.messages.map { "$it: ${it.renderMessage()}" }.joinToString("\n")}\n" +
"TMPFILE_TEXT:\n${tmpFile.text}\n" +
"FILE TEXT: \n${breakpointFile.getText()}\n") "FILE TEXT: \n${breakpointFile.getText()}\n")
} }
return analysisResult.messages.map { errorMessage -> return analysisResult.messages.map { errorMessage ->
@@ -91,7 +92,7 @@ fun getFunctionForExtractedFragment(
captureLocalFunctions = true) captureLocalFunctions = true)
val analysisResult = ExtractionData(tmpFile, newDebugExpressions.toRange(), targetSibling, null, options).performAnalysis() val analysisResult = ExtractionData(tmpFile, newDebugExpressions.toRange(), targetSibling, null, options).performAnalysis()
if (analysisResult.status != Status.SUCCESS) { if (analysisResult.status != Status.SUCCESS) {
throw EvaluateExceptionUtil.createEvaluateException(getErrorMessageForExtractFunctionResult(analysisResult)) throw EvaluateExceptionUtil.createEvaluateException(getErrorMessageForExtractFunctionResult(analysisResult, tmpFile))
} }
val validationResult = analysisResult.descriptor!!.validate() val validationResult = analysisResult.descriptor!!.validate()