IR: wrap exceptions and add file path in per-file lowerings
Also add file path to the wrapped exception in JVM IR codegen
This commit is contained in:
@@ -23,7 +23,9 @@ import org.jetbrains.kotlin.resolve.bindingContextUtil.isUsedAsExpression
|
||||
import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall
|
||||
import org.jetbrains.kotlin.resolve.multiplatform.ExpectedActualResolver
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.util.getExceptionMessage
|
||||
import org.jetbrains.kotlin.utils.DFS
|
||||
import org.jetbrains.kotlin.utils.KotlinExceptionWithAttachments
|
||||
|
||||
object CodegenUtil {
|
||||
@JvmStatic
|
||||
@@ -236,4 +238,15 @@ object CodegenUtil {
|
||||
{ it.declaresDefaultValue() }
|
||||
)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun reportBackendException(exception: Throwable, phase: String, fileUrl: String?): Nothing {
|
||||
// CompilationException (the only KotlinExceptionWithAttachments possible here) is already supposed
|
||||
// to have all information about the context.
|
||||
if (exception is KotlinExceptionWithAttachments) throw exception
|
||||
throw IllegalStateException(
|
||||
getExceptionMessage("Backend", "Exception during $phase", exception, fileUrl),
|
||||
exception
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user