[IR] Be ready if message of CompilationException throw exception

This commit is contained in:
Ilya Goncharov
2021-12-10 13:39:28 +03:00
committed by Space
parent d13f6744a6
commit 0b871d7534
@@ -22,12 +22,18 @@ class CompilationException(
cause: Throwable? = null cause: Throwable? = null
) : RuntimeException(message, cause) { ) : RuntimeException(message, cause) {
override val message: String override val message: String
get() = buildString { get() = try {
buildString {
appendLine("Back-end: Please report this problem https://kotl.in/issue") appendLine("Back-end: Please report this problem https://kotl.in/issue")
path?.let { appendLine("$it:$line:$column") } path?.let { appendLine("$it:$line:$column") }
content?.let { appendLine("Problem with `$it`") } content?.let { appendLine("Problem with `$it`") }
append("Details: " + super.message) append("Details: " + super.message)
} }
} catch (e: Throwable) {
throw IllegalStateException("Problem with constructing exception message").also {
it.stackTrace = stackTrace
}
}
val line: Int val line: Int
get() { get() {