Kapt3: Fix stack trace reporting (KT-15433)
This commit is contained in:
committed by
Yan Zhulanow
parent
8953e33417
commit
aa84cc4911
@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.kapt3.util
|
|||||||
import org.jetbrains.kotlin.cli.common.messages.*
|
import org.jetbrains.kotlin.cli.common.messages.*
|
||||||
import java.io.ByteArrayOutputStream
|
import java.io.ByteArrayOutputStream
|
||||||
import java.io.PrintWriter
|
import java.io.PrintWriter
|
||||||
|
import java.io.StringWriter
|
||||||
|
|
||||||
class KaptLogger(
|
class KaptLogger(
|
||||||
val isVerbose: Boolean,
|
val isVerbose: Boolean,
|
||||||
@@ -50,9 +51,9 @@ class KaptLogger(
|
|||||||
|
|
||||||
fun exception(e: Throwable) {
|
fun exception(e: Throwable) {
|
||||||
val stacktrace = run {
|
val stacktrace = run {
|
||||||
val byteArrayOutputStream = ByteArrayOutputStream()
|
val writer = StringWriter()
|
||||||
e.printStackTrace(PrintWriter(byteArrayOutputStream))
|
e.printStackTrace(PrintWriter(writer))
|
||||||
byteArrayOutputStream.toString("UTF-8")
|
writer.toString()
|
||||||
}
|
}
|
||||||
messageCollector.report(CompilerMessageSeverity.EXCEPTION, PREFIX + "An exception occurred: " + stacktrace, CompilerMessageLocation.NO_LOCATION)
|
messageCollector.report(CompilerMessageSeverity.EXCEPTION, PREFIX + "An exception occurred: " + stacktrace, CompilerMessageLocation.NO_LOCATION)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user