[Analysis API] do not throw exception when KtCall is improperly resolved
Log the exception instead. This way the analysis of the file will not be stuck after finding an improperly resolved call
This commit is contained in:
committed by
Space Team
parent
4a872928dd
commit
8b286577c7
+12
@@ -5,6 +5,8 @@
|
||||
|
||||
package org.jetbrains.kotlin.analysis.utils.errors
|
||||
|
||||
import com.intellij.openapi.diagnostic.Attachment
|
||||
import com.intellij.openapi.diagnostic.Logger
|
||||
import org.jetbrains.kotlin.analysis.utils.printer.PrettyPrinter
|
||||
import org.jetbrains.kotlin.analysis.utils.printer.prettyPrint
|
||||
import org.jetbrains.kotlin.util.SourceCodeAnalysisException
|
||||
@@ -70,6 +72,16 @@ public inline fun buildErrorWithAttachment(
|
||||
throw exception
|
||||
}
|
||||
|
||||
public inline fun Logger.logErrorWithAttachment(
|
||||
message: String,
|
||||
cause: Exception? = null,
|
||||
attachmentName: String = "info.txt",
|
||||
buildAttachment: ExceptionAttachmentBuilder.() -> Unit = {}
|
||||
) {
|
||||
val attachment = Attachment(attachmentName, ExceptionAttachmentBuilder().apply(buildAttachment).buildString())
|
||||
this.error(message, cause, attachment)
|
||||
}
|
||||
|
||||
public inline fun rethrowExceptionWithDetails(
|
||||
message: String,
|
||||
exception: Exception,
|
||||
|
||||
Reference in New Issue
Block a user