Skip to content

Commit abb6763

Browse files
authored
Merge pull request #278 from EasyPost/bad_request_error
feat: maps 400 status codes to BadRequestError class
2 parents c724afc + 8b61781 commit abb6763

File tree

5 files changed

+120
-67
lines changed

5 files changed

+120
-67
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## Next release
44

55
- Adds new `RequestHook` and `ResponseHook` classes. (un)subscribe to them with the new `subscribeToRequestHook`, `subscribeToResponseHook`, `unsubscribeFromRequestHook`, or `unsubscribeFromResponseHook` methods of an `EasyPostClient`
6+
- Maps 400 status codes to the new `BadRequestError` class
67

78
## v6.7.0 (2023-06-06)
89

src/main/java/com/easypost/Constants.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public abstract static class ErrorMessages {
4242
public abstract static class ErrorCodes {
4343
public static final int REDIRECT_CODE_BEGIN = 300;
4444
public static final int REDIRECT_CODE_END = 308;
45+
public static final int BAD_REQUEST_ERROR = 400;
4546
public static final int UNAUTHORIZED_ERROR = 401;
4647
public static final int PAYMENT_ERROR = 402;
4748
public static final int FORBIDDEN_ERROR = 403;
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package com.easypost.exception.API;
2+
3+
import java.util.List;
4+
5+
import com.easypost.model.Error;
6+
import com.easypost.exception.APIException;
7+
8+
public class BadRequestError extends APIException {
9+
/**
10+
* BadRequestError constructor.
11+
*
12+
* @param message the exception message
13+
* @param code the exception code
14+
* @param statusCode the exception status code
15+
* @param errors the errors array
16+
*/
17+
public BadRequestError(final String message, final String code, final int statusCode, List<Error> errors) {
18+
super(message, code, statusCode, errors);
19+
}
20+
}

0 commit comments

Comments
 (0)