Keep attachments of cause exception in KotlinExceptionWithAttachments and provide elements in attachments in case of errors during kotlin idea resolution

Relates to EA-210942, EA-209622 etc
This commit is contained in:
Vladimir Dolzhenko
2019-10-16 18:10:04 +02:00
parent 39f4a95278
commit 30b98aaeb7
2 changed files with 9 additions and 2 deletions
@@ -13,7 +13,11 @@ open class KotlinExceptionWithAttachments : RuntimeException, ExceptionWithAttac
constructor(message: String) : super(message)
constructor(message: String?, cause: Throwable?) : super(message, cause)
constructor(message: String?, cause: Throwable?) : super(message, cause) {
if (cause is KotlinExceptionWithAttachments) {
attachments.addAll(cause.attachments)
}
}
override fun getAttachments(): Array<Attachment> = attachments.toTypedArray()
@@ -118,6 +118,9 @@ private class KotlinIdeaResolutionException(
appendln("---------------------------------------------")
append(creationPlace.description())
})
for (element in resolvingWhat.elements.withIndex()) {
withAttachment("element${element.index}.kt", element.value.text)
}
}
}
@@ -142,7 +145,7 @@ private class CreationPlace(
}
private class ResolvingWhat(
private val elements: Collection<PsiElement> = emptyList(),
val elements: Collection<PsiElement> = emptyList(),
private val bodyResolveMode: BodyResolveMode? = null,
private val serviceClass: Class<*>? = null,
private val moduleDescriptor: ModuleDescriptor? = null