mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 08:27:12 -07:00
Better error message.
This commit is contained in:
parent
18a34a2cc9
commit
7970b5cc27
1 changed files with 3 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
||||||
package com.beust.kobalt.plugin.kotlin
|
package com.beust.kobalt.plugin.kotlin
|
||||||
|
|
||||||
|
import com.beust.kobalt.KobaltException
|
||||||
import com.beust.kobalt.TaskResult
|
import com.beust.kobalt.TaskResult
|
||||||
import com.beust.kobalt.api.*
|
import com.beust.kobalt.api.*
|
||||||
import com.beust.kobalt.internal.ICompilerAction
|
import com.beust.kobalt.internal.ICompilerAction
|
||||||
|
@ -98,12 +99,13 @@ class KotlinCompiler @Inject constructor(
|
||||||
throw UnsupportedOperationException("not implemented")
|
throw UnsupportedOperationException("not implemented")
|
||||||
}
|
}
|
||||||
|
|
||||||
fun CompilerMessageLocation.dump(s: String) = "$path:$line:$column $s"
|
fun CompilerMessageLocation.dump(s: String) = "$lineContent\n$path:$line:$column $s"
|
||||||
|
|
||||||
override fun report(severity: CompilerMessageSeverity,
|
override fun report(severity: CompilerMessageSeverity,
|
||||||
message: String, location: CompilerMessageLocation) {
|
message: String, location: CompilerMessageLocation) {
|
||||||
if (severity.isError) {
|
if (severity.isError) {
|
||||||
System.err.println(location.dump(message))
|
System.err.println(location.dump(message))
|
||||||
|
throw KobaltException("Couldn't compile build file: $message")
|
||||||
} else if (severity == CompilerMessageSeverity.WARNING && KobaltLogger.LOG_LEVEL >= 2) {
|
} else if (severity == CompilerMessageSeverity.WARNING && KobaltLogger.LOG_LEVEL >= 2) {
|
||||||
warn(location.dump(message))
|
warn(location.dump(message))
|
||||||
} else if (severity == CompilerMessageSeverity.INFO && KobaltLogger.LOG_LEVEL >= 2) {
|
} else if (severity == CompilerMessageSeverity.INFO && KobaltLogger.LOG_LEVEL >= 2) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue