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

Added error codes for funding sources errors #30

Merged
merged 4 commits into from
Jan 9, 2025
Merged
Changes from 3 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
29 changes: 16 additions & 13 deletions src/main/java/com/shipengine/exception/ShipEngineException.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ public enum ErrorType {
ERROR,
SECURITY,
SYSTEM,
VALIDATION
VALIDATION,
WALLET,
FUNDING_SOURCES
}

public enum ErrorCode {
Expand Down Expand Up @@ -81,7 +83,9 @@ public enum ErrorCode {
UNSPECIFIED,
VERIFICATION_CONFLICT,
WAREHOUSE_CONFLICT,
WEBHOOK_EVENT_TYPE_CONFLICT
WEBHOOK_EVENT_TYPE_CONFLICT,
FUNDING_SOURCE_MISSING_CONFIGURATION,
FUNDING_SOURCE_ERROR
}

/**
Expand All @@ -96,23 +100,26 @@ public enum ErrorCode {
* contact ShipEngine for support or if you should contact the carrier or
* marketplace instead.
*
* @see <a href="https://www.shipengine.com/docs/errors/codes/#error-source">...</a>
* @see <a href=
* "https://www.shipengine.com/docs/errors/codes/#error-source">...</a>
*/
private ErrorSource source;

/**
* Indicates the type of error that occurred, such as a validation error, a
* security error, etc.
*
* @see <a href="https://www.shipengine.com/docs/errors/codes/#error-type">...</a>
* @see <a href=
* "https://www.shipengine.com/docs/errors/codes/#error-type">...</a>
*/
private ErrorType type;

/**
* A code that indicates the specific error that occurred, such as missing a
* required field, an invalid address, a timeout, etc.
*
* @see <a href="https://www.shipengine.com/docs/errors/codes/#error-code">...</a>
* @see <a href=
* "https://www.shipengine.com/docs/errors/codes/#error-code">...</a>
*/
private ErrorCode code;

Expand Down Expand Up @@ -172,8 +179,7 @@ public ShipEngineException(
ErrorSource source,
ErrorType type,
ErrorCode code,
String url
) {
String url) {
super(message);
setRequestID(requestID);
setSource(source);
Expand All @@ -187,8 +193,7 @@ public ShipEngineException(
ErrorSource source,
ErrorType type,
ErrorCode code,
String url
) {
String url) {
super(message);
setSource(source);
setType(type);
Expand All @@ -201,8 +206,7 @@ public ShipEngineException(
String requestID,
String source,
String type,
String code
) {
String code) {
super(message);
setRequestID(requestID);
setSource(ErrorSource.valueOf(source.toUpperCase()));
Expand All @@ -214,8 +218,7 @@ public ShipEngineException(
String message,
String source,
String type,
String code
) {
String code) {
super(message);
setSource(ErrorSource.valueOf(source.toUpperCase()));
setType(ErrorType.valueOf(type.toUpperCase()));
Expand Down
Loading