From 7970b5cc276d91a1289e98e766e05b1d35feea01 Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Thu, 28 Jul 2016 23:30:19 -0800 Subject: [PATCH] Better error message. --- .../kotlin/com/beust/kobalt/plugin/kotlin/KotlinCompiler.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/com/beust/kobalt/plugin/kotlin/KotlinCompiler.kt b/src/main/kotlin/com/beust/kobalt/plugin/kotlin/KotlinCompiler.kt index 2d27a849..032a1977 100644 --- a/src/main/kotlin/com/beust/kobalt/plugin/kotlin/KotlinCompiler.kt +++ b/src/main/kotlin/com/beust/kobalt/plugin/kotlin/KotlinCompiler.kt @@ -1,5 +1,6 @@ package com.beust.kobalt.plugin.kotlin +import com.beust.kobalt.KobaltException import com.beust.kobalt.TaskResult import com.beust.kobalt.api.* import com.beust.kobalt.internal.ICompilerAction @@ -98,12 +99,13 @@ class KotlinCompiler @Inject constructor( 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, message: String, location: CompilerMessageLocation) { if (severity.isError) { System.err.println(location.dump(message)) + throw KobaltException("Couldn't compile build file: $message") } else if (severity == CompilerMessageSeverity.WARNING && KobaltLogger.LOG_LEVEL >= 2) { warn(location.dump(message)) } else if (severity == CompilerMessageSeverity.INFO && KobaltLogger.LOG_LEVEL >= 2) {