1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-26 00:17:11 -07:00

Handle task exceptions.

This commit is contained in:
Cedric Beust 2015-11-14 06:25:46 -08:00
parent cc7d5d29c6
commit 2d2ede3656

View file

@ -4,7 +4,6 @@ import com.beust.kobalt.api.*
import com.beust.kobalt.api.annotation.Task
import com.beust.kobalt.internal.PluginInfo
import com.beust.kobalt.internal.TaskManager
import com.beust.kobalt.TaskResult
import com.beust.kobalt.maven.DepFactory
import com.beust.kobalt.maven.IClasspathDependency
import com.beust.kobalt.maven.KobaltException
@ -101,7 +100,11 @@ public class Plugins @Inject constructor (val taskManagerProvider : Provider<Tas
fun toTask(m: Method, project: Project, plugin: IPlugin): (Project) -> TaskResult {
val result: (Project) -> TaskResult = {
m.invoke(plugin, project) as TaskResult
try {
m.invoke(plugin, project) as TaskResult
} catch(ex: Throwable) {
throw KobaltException("Error while invoking task $m on plugin $plugin")
}
}
return result
}