Skip to content

Commit

Permalink
Amend certain error response formats to include HTTP status.
Browse files Browse the repository at this point in the history
RB=619857
R=apadmara
A=apadmara
  • Loading branch information
Erluo Li committed Nov 25, 2015
1 parent 3661f07 commit 0ec0347
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
3.1.4
-----

3.1.3
-----
(RB=619857)
Add HTTP status code in response body for ErrorResponse in certain formats.

3.1.2
------
(RB=618172)
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version=3.1.2
version=3.1.3
sonatypeUsername=please_set_in_home_dir_if_uploading_to_maven_central
sonatypePassword=please_set_in_home_dir_if_uploading_to_maven_central

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ public enum ErrorResponseFormat
MESSAGE_AND_DETAILS(EnumSet.of(ErrorResponsePart.MESSAGE, ErrorResponsePart.DETAILS, ErrorResponsePart.HEADERS)),

/**
* Only the error message, service error code, and headers.
* Only the status code, error message, service error code, and headers.
*/
MESSAGE_AND_SERVICECODE(EnumSet.of(ErrorResponsePart.MESSAGE, ErrorResponsePart.SERVICE_ERROR_CODE, ErrorResponsePart.HEADERS)),
MESSAGE_AND_SERVICECODE(EnumSet.of(ErrorResponsePart.STATUS_CODE_IN_BODY, ErrorResponsePart.MESSAGE, ErrorResponsePart.SERVICE_ERROR_CODE, ErrorResponsePart.HEADERS)),

/**
* Only the error message, service error code, exception class, and headers.
* Only the status code, error message, service error code, exception class, and headers.
*/
MESSAGE_AND_SERVICECODE_AND_EXCEPTIONCLASS(EnumSet.of(ErrorResponsePart.MESSAGE, ErrorResponsePart.SERVICE_ERROR_CODE, ErrorResponsePart.EXCEPTION_CLASS, ErrorResponsePart.HEADERS)),
MESSAGE_AND_SERVICECODE_AND_EXCEPTIONCLASS(EnumSet.of(ErrorResponsePart.STATUS_CODE_IN_BODY, ErrorResponsePart.MESSAGE, ErrorResponsePart.SERVICE_ERROR_CODE, ErrorResponsePart.EXCEPTION_CLASS, ErrorResponsePart.HEADERS)),

/**
* Only the error message and headers.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public void testExceptionClass()
ErrorResponse errorResponse = builder.buildErrorResponse(exception);
Assert.assertFalse(errorResponse.hasErrorDetails());
Assert.assertTrue(errorResponse.hasExceptionClass());
Assert.assertFalse(errorResponse.hasStatus());
Assert.assertTrue(errorResponse.hasStatus());
Assert.assertTrue(errorResponse.hasMessage());
Assert.assertTrue(errorResponse.hasServiceErrorCode());
Assert.assertFalse(errorResponse.hasStackTrace());
Expand All @@ -130,7 +130,7 @@ public void testOverride()
errorResponse = builder.buildErrorResponse(exception);
Assert.assertFalse(errorResponse.hasErrorDetails());
Assert.assertFalse(errorResponse.hasExceptionClass());
Assert.assertFalse(errorResponse.hasStatus());
Assert.assertTrue(errorResponse.hasStatus());
Assert.assertTrue(errorResponse.hasMessage());
Assert.assertTrue(errorResponse.hasServiceErrorCode());
Assert.assertFalse(errorResponse.hasStackTrace());
Expand Down

0 comments on commit 0ec0347

Please sign in to comment.