Added exception handling during parsion Salt API JSON response
Change-Id: Id6fd7bf35c08ba0c76405f8797b80e93919800a5
diff --git a/src/com/mirantis/mk/Salt.groovy b/src/com/mirantis/mk/Salt.groovy
index c7b2d37..c112de8 100644
--- a/src/com/mirantis/mk/Salt.groovy
+++ b/src/com/mirantis/mk/Salt.groovy
@@ -737,5 +737,12 @@
).trim()
}
- return new groovy.json.JsonSlurperClassic().parseText(output)
+ def outputObj
+ try {
+ outputObj = new groovy.json.JsonSlurperClassic().parseText(output)
+ } catch(Exception e) {
+ common.errorMsg("Parsing Salt API JSON response failed! Response: " + output)
+ throw e
+ }
+ return outputObj
}