Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: maps 400 status codes to BadRequestError class #278

Merged
merged 2 commits into from
Jul 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Next release

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

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

Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/easypost/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public abstract static class ErrorMessages {
public abstract static class ErrorCodes {
public static final int REDIRECT_CODE_BEGIN = 300;
public static final int REDIRECT_CODE_END = 308;
public static final int BAD_REQUEST_ERROR = 400;
public static final int UNAUTHORIZED_ERROR = 401;
public static final int PAYMENT_ERROR = 402;
public static final int FORBIDDEN_ERROR = 403;
Expand Down
20 changes: 20 additions & 0 deletions src/main/java/com/easypost/exception/API/BadRequestError.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.easypost.exception.API;

import java.util.List;

import com.easypost.model.Error;
import com.easypost.exception.APIException;

public class BadRequestError extends APIException {
/**
* BadRequestError constructor.
*
* @param message the exception message
* @param code the exception code
* @param statusCode the exception status code
* @param errors the errors array
*/
public BadRequestError(final String message, final String code, final int statusCode, List<Error> errors) {
super(message, code, statusCode, errors);
}
}
Loading