Repository: ballerina-platform/module-ballerina-c2c
Issue: Throws exception when Docker is not started

**Description:**
When trying to build docker without docker running following error is thrown. We need to handle it gracefully.

```
Nov 27, 2021 7:20:27 PM com.github.dockerjava.api.async.ResultCallbackTemplate onError
SEVERE: Error during callback
java.lang.RuntimeException: java.io.IOException: com.sun.jna.LastErrorException: [61] Connection refused
	at com.github.dockerjava.httpclient5.ApacheDockerHttpClientImpl.execute(ApacheDockerHttpClientImpl.java:179)
	at com.github.dockerjava.httpclient5.ApacheDockerHttpClient.execute(ApacheDockerHttpClient.java:9)
	at com.github.dockerjava.core.DefaultInvocationBuilder.execute(DefaultInvocationBuilder.java:228)
	at com.github.dockerjava.core.DefaultInvocationBuilder.lambda$executeAndStream$1(DefaultInvocationBuilder.java:269)
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.io.IOException: com.sun.jna.LastErrorException: [61] Connection refused
	at com.github.dockerjava.transport.DomainSocket.<init>(DomainSocket.java:63)
```	

**Steps to reproduce:**

**Affected Versions:**

**OS, DB, other environment details and versions:**

**Related Issues (optional):**
<!-- Any related issues such as sub tasks, issues reported in other repositories (e.g component repositories), similar problems, etc. -->

**Suggested Labels (optional):**
<!-- Optional comma separated list of suggested labels. Non committers can’t assign labels to issues, so this will help issue creators who are not a committer to suggest possible labels-->

**Suggested Assignees (optional):**
<!--Optional comma separated list of suggested team members who should attend the issue. Non committers can’t assign issues to assignees, so this will help issue creators who are not a committer to suggest possible assignees-->


Changed files:
c2c-extension/src/main/java/io/ballerina/c2c/exceptions/KubernetesPluginException.java
c2c-extension/src/main/java/io/ballerina/c2c/handlers/DockerHandler.java
c2c-extension/src/main/java/io/ballerina/c2c/tasks/C2CCodeGeneratedTask.java

diff --git a/c2c-extension/src/main/java/io/ballerina/c2c/exceptions/KubernetesPluginException.java b/c2c-extension/src/main/java/io/ballerina/c2c/exceptions/KubernetesPluginException.java
index f903b4d..348e01f 100644
--- a/c2c-extension/src/main/java/io/ballerina/c2c/exceptions/KubernetesPluginException.java
+++ b/c2c-extension/src/main/java/io/ballerina/c2c/exceptions/KubernetesPluginException.java
@@ -25,13 +25,25 @@ import io.ballerina.tools.diagnostics.Diagnostic;
  */
 public class KubernetesPluginException extends Exception {
     private final Diagnostic diagnostic;
+    private final boolean skipPrintTrace;
 
     public KubernetesPluginException(Diagnostic diagnostic) {
         super(diagnostic.message());
         this.diagnostic = diagnostic;
+        this.skipPrintTrace = false;
+    }
+
+    public KubernetesPluginException(Diagnostic diagnostic, boolean skipPrintTrace) {
+        super(diagnostic.message());
+        this.diagnostic = diagnostic;
+        this.skipPrintTrace = skipPrintTrace;
     }
 
     public Diagnostic getDiagnostic() {
         return diagnostic;
     }
+
+    public boolean isSkipPrintTrace() {
+        return this.skipPrintTrace;
+    }
 }
diff --git a/c2c-extension/src/main/java/io/ballerina/c2c/handlers/DockerHandler.java b/c2c-extension/src/main/java/io/ballerina/c2c/handlers/DockerHandler.java
index 99bf59b..24626d9 100644
--- a/c2c-extension/src/main/java/io/ballerina/c2c/handlers/DockerHandler.java
+++ b/c2c-extension/src/main/java/io/ballerina/c2c/handlers/DockerHandler.java
@@ -45,7 +45,7 @@ public class DockerHandler extends AbstractArtifactHandler {
             DiagnosticInfo diagnosticInfo = new DiagnosticInfo(C2CDiagnosticCodes.DOCKER_FAILED.getCode(),
                     e.getMessage(), DiagnosticSeverity.WARNING);
             Diagnostic diagnostic = DiagnosticFactory.createDiagnostic(diagnosticInfo, new NullLocation());
-            throw new KubernetesPluginException(diagnostic);
+            throw new KubernetesPluginException(diagnostic, true);
         }
     }
 }
diff --git a/c2c-extension/src/main/java/io/ballerina/c2c/tasks/C2CCodeGeneratedTask.java b/c2c-extension/src/main/java/io/ballerina/c2c/tasks/C2CCodeGeneratedTask.java
index 2ac7ec0..6e51758 100644
--- a/c2c-extension/src/main/java/io/ballerina/c2c/tasks/C2CCodeGeneratedTask.java
+++ b/c2c-extension/src/main/java/io/ballerina/c2c/tasks/C2CCodeGeneratedTask.java
@@ -118,7 +118,9 @@ public class C2CCodeGeneratedTask implements CompilerLifecycleTask<CompilerLifec
             } catch (KubernetesPluginException e) {
                 String errorMessage = "module [" + packageId + "] " + e.getMessage();
                 printError(errorMessage);
-                pluginLog.error(errorMessage, e);
+                if (!e.isSkipPrintTrace()) {
+                    pluginLog.error(errorMessage, e);
+                }
                 try {
                     KubernetesUtils.deleteDirectory(kubernetesOutputPath);
                 } catch (KubernetesPluginException ignored) {