aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/org/onap/dcae/restapi/ApiException.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/onap/dcae/restapi/ApiException.java')
-rw-r--r--src/main/java/org/onap/dcae/restapi/ApiException.java22
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());
+ }
+ }
+
}