Skip to content

Commit

Permalink
Add error logs
Browse files Browse the repository at this point in the history
  • Loading branch information
manojlds committed May 22, 2016
1 parent 1dd6c1a commit 09016b2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 0 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ lazy val root = project in file(".") aggregate dockerTask
lazy val commonSettings = Seq(
organization := "com.stacktoheap",
version := appVersion,
scalaVersion := "2.10.4",
unmanagedBase := file(".") / "lib",
libraryDependencies ++= Seq(
apacheCommons, commonsIo, goPluginLibrary, gson, junit, hamcrest, mockito
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@

import com.stacktoheap.go.docker.Commands.DockerCleanupCommand;
import com.stacktoheap.go.docker.Commands.DockerTaskCommand;
import com.thoughtworks.go.plugin.api.logging.Logger;

public class DockerTaskExecutor {
Logger logger = Logger.getLoggerFor(DockerTask.class);

public Result execute(Config config, Context context) {
try {
return runCommand(context, config);
} catch (Exception e) {
return new Result(false, "Failed while running the task", e);
} catch (Exception ex) {
logger.error("Error running the command", ex);
return new Result(false, "Failed while running the task", ex);
}
}

Expand All @@ -17,6 +21,7 @@ private Result runCommand(Context taskContext, Config taskConfig) throws Excepti
new DockerTaskCommand(taskContext, taskConfig).run();
return new Result(true, "Finished");
} catch(Exception ex) {
logger.error("Error running the command", ex);
return new Result(false, "Failed", ex);
} finally {
new DockerCleanupCommand(taskContext, taskConfig).run();
Expand Down

0 comments on commit 09016b2

Please sign in to comment.