diff options
author | 2018-08-02 03:26:14 +0000 | |
---|---|---|
committer | 2018-08-02 03:26:14 +0000 | |
commit | 654ebdff4c9ec2487b819d2b76273732759de4c7 (patch) | |
tree | 5681e5435d4801be22ef13b9b6263137d5e891f4 /src/main/java/org/onap/dcae/restapi/ApiException.java | |
parent | ab85ff62566a1fa8ef6b2ee86a93ab741cd434ed (diff) | |
parent | fc073344d4c0eb8a28bf34c07a8439176cf846ca (diff) |
Merge "Replace nsaCore library with Spring"
Diffstat (limited to 'src/main/java/org/onap/dcae/restapi/ApiException.java')
-rw-r--r-- | src/main/java/org/onap/dcae/restapi/ApiException.java | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/main/java/org/onap/dcae/restapi/ApiException.java b/src/main/java/org/onap/dcae/restapi/ApiException.java index 0f922678..53895ffe 100644 --- a/src/main/java/org/onap/dcae/restapi/ApiException.java +++ b/src/main/java/org/onap/dcae/restapi/ApiException.java @@ -33,10 +33,10 @@ public enum ApiException { UNAUTHORIZED_USER(ExceptionType.POLICY_EXCEPTION, "POL2000", "Unauthorized user", 401), NO_SERVER_RESOURCES(ExceptionType.SERVICE_EXCEPTION, "SVC1000", "No server resources (internal processing queue full)", 503); + public final int httpStatusCode; private final ExceptionType type; private final String code; private final String details; - public final int httpStatusCode; ApiException(ExceptionType type, String code, String details, int httpStatusCode) { this.type = type; @@ -45,18 +45,9 @@ public enum ApiException { this.httpStatusCode = httpStatusCode; } - public enum ExceptionType { - SERVICE_EXCEPTION, POLICY_EXCEPTION; - - @Override - public String toString() { - return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, this.name()); - } - } - public JSONObject toJSON() { JSONObject exceptionTypeNode = new JSONObject(); - exceptionTypeNode.put("messageId", code ); + exceptionTypeNode.put("messageId", code); exceptionTypeNode.put("text", details); JSONObject requestErrorNode = new JSONObject(); @@ -67,4 +58,13 @@ public enum ApiException { return rootNode; } + public enum ExceptionType { + SERVICE_EXCEPTION, POLICY_EXCEPTION; + + @Override + public String toString() { + return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, this.name()); + } + } + } |