diff options
Diffstat (limited to 'framework/src/main/java/org/onap/cli/fw/error/OnapCommandException.java')
-rw-r--r-- | framework/src/main/java/org/onap/cli/fw/error/OnapCommandException.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandException.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandException.java index 3fecad02..5dffde5c 100644 --- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandException.java +++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandException.java @@ -16,6 +16,7 @@ package org.onap.cli.fw.error; +import org.onap.cli.fw.conf.OnapCommandConstants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -89,6 +90,12 @@ public class OnapCommandException extends Exception { return message; } + public String toJsonString() { + return "{\""+ OnapCommandConstants.ERROR + "\": {\""+ + OnapCommandConstants.ERROR_CODE + "\": \"" + this.errorCode + "\", \""+ + OnapCommandConstants.ERROR_MESSAGE + "\": \"" + this.errorMessage + "\"}}"; + } + public OnapCommandException(String errorCode, String errorMessage, Throwable e) { this(errorCode, errorMessage + ", " + e.getMessage()); LOG.error(this.getMessage(), e); |