Merge "Improved error handling in test pipelines."
diff --git a/test-groovy-pipeline.groovy b/test-groovy-pipeline.groovy
index 71e9fc0..edd549a 100644
--- a/test-groovy-pipeline.groovy
+++ b/test-groovy-pipeline.groovy
@@ -38,7 +38,7 @@
               checkouted = gerrit.gerritPatchsetCheckout(defaultGitUrl, defaultGitRef, "HEAD", CREDENTIALS_ID)
           }
           if(!checkouted){
-            common.errorMsg("Cannot checkout gerrit patchset, GERRIT_REFSPEC and DEFAULT_GIT_REF is null")
+            throw new Exception("Cannot checkout gerrit patchset, GERRIT_REFSPEC and DEFAULT_GIT_REF is null")
           }
         }
         stage ('Run Codenarc tests'){
diff --git a/test-salt-formulas-pipeline.groovy b/test-salt-formulas-pipeline.groovy
index 91f977b..e53e652 100644
--- a/test-salt-formulas-pipeline.groovy
+++ b/test-salt-formulas-pipeline.groovy
@@ -37,7 +37,7 @@
           checkouted = gerrit.gerritPatchsetCheckout(defaultGitUrl, defaultGitRef, "HEAD", CREDENTIALS_ID)
       }
       if(!checkouted){
-        common.errorMsg("Cannot checkout gerrit patchset, GERRIT_REFSPEC and DEFAULT_GIT_REF is null")
+        throw new Exception("Cannot checkout gerrit patchset, GERRIT_REFSPEC and DEFAULT_GIT_REF is null")
       }
     }
     stage("test") {
diff --git a/test-salt-models-pipeline.groovy b/test-salt-models-pipeline.groovy
index 05695b2..d43c217 100644
--- a/test-salt-models-pipeline.groovy
+++ b/test-salt-models-pipeline.groovy
@@ -49,7 +49,7 @@
           ssh.agentSh("git submodule init; git submodule sync; git submodule update --recursive")
         }
       }else{
-        common.errorMsg("Cannot checkout gerrit patchset, GERRIT_REFSPEC and DEFAULT_GIT_REF is null")
+        throw new Exception("Cannot checkout gerrit patchset, GERRIT_REFSPEC and DEFAULT_GIT_REF is null")
       }
     }
     stage("test") {
diff --git a/test-system-reclass-pipeline.groovy b/test-system-reclass-pipeline.groovy
index a63a7df..65fce27 100644
--- a/test-system-reclass-pipeline.groovy
+++ b/test-system-reclass-pipeline.groovy
@@ -57,7 +57,7 @@
         }
       parallel branches
     }else{
-       common.errorMsg("Cannot checkout gerrit patchset, GERRIT_REFSPEC and DEFAULT_GIT_REF is null")
+       throw new Exception("Cannot checkout gerrit patchset, GERRIT_REFSPEC and DEFAULT_GIT_REF is null")
     }
   }
 } catch (Throwable e) {