converted rootCause to String instead of Throwable

This commit is contained in:
2018-01-20 17:48:50 +01:00
parent 3e9141d563
commit 95c169bec0
2 changed files with 5 additions and 5 deletions

View File

@ -37,7 +37,7 @@ public class APIErrorResponse {
private final Response.Status status;
private final String errorCode;
private final String message;
private final Throwable rootCause;
private final String rootCause;
public APIErrorResponse(APIError apiError, Locale locale) {
this.status = apiError.getStatus();
@ -50,7 +50,7 @@ public class APIErrorResponse {
this.status = apiError.getStatus();
this.errorCode = apiError.getErrorCode();
this.message = getLocalizedMessage(apiError, locale);
this.rootCause = th;
this.rootCause = th.getMessage();
}
public APIErrorResponse(Exception exception, Locale locale) {
@ -64,7 +64,7 @@ public class APIErrorResponse {
this.status = Response.Status.INTERNAL_SERVER_ERROR;
this.errorCode = "0";
this.message = exception.getLocalizedMessage();
this.rootCause = th;
this.rootCause = th.getMessage();
}
public APIErrorResponse(Response.Status status, String errorCode, String messageKey, Locale locale) {
@ -86,7 +86,7 @@ public class APIErrorResponse {
return this.message;
}
public Throwable getRootCause() {
public String getRootCause() {
return rootCause;
}

View File

@ -54,7 +54,7 @@ public class APIException extends RuntimeException {
.header(HTTP_HEADER_X_ERROR_CODE, response.getErrorCode());
if (response.getRootCause() != null) {
builder = builder.header(HTTP_HEADER_X_ROOT_CAUSE, builder);
builder = builder.header(HTTP_HEADER_X_ROOT_CAUSE, response.getRootCause());
}
return builder.build();