Skip to content

Commit d93e46a

Browse files
committed
chore: replace Error model with APIException
1 parent edb1455 commit d93e46a

27 files changed

+211
-186
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package com.easypost;
22

3+
import com.easypost.exception.APIException;
34
import com.easypost.http.HashMapSerializer;
45
import com.easypost.model.AddressVerification;
56
import com.easypost.model.AddressVerificationDeserializer;
6-
import com.easypost.model.Error;
77
import com.easypost.model.ErrorDeserializer;
88
import com.easypost.model.SmartrateCollection;
99
import com.easypost.model.SmartrateCollectionDeserializer;
@@ -80,7 +80,7 @@ public abstract static class Http {
8080
.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
8181
.registerTypeAdapter(HashMap.class, new HashMapSerializer())
8282
.registerTypeAdapter(SmartrateCollection.class, new SmartrateCollectionDeserializer())
83-
.registerTypeAdapter(Error.class, new ErrorDeserializer())
83+
.registerTypeAdapter(APIException.class, new ErrorDeserializer())
8484
.registerTypeAdapter(AddressVerification.class, new AddressVerificationDeserializer())
8585
.registerTypeAdapter(StatelessRate[].class, new StatelessRateDeserializer())
8686
.registerTypeAdapter(Webhook[].class, new WebhookDeserializer()).create();

src/main/java/com/easypost/exception/API/BadRequestError.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ public class BadRequestError extends APIException {
99
*
1010
* @param message the exception message
1111
* @param code the exception code
12-
* @param statusCode the exception status code
1312
* @param errors the errors array
13+
* @param statusCode the exception status code
1414
*/
15-
public BadRequestError(final String message, final String code, final int statusCode, FieldErrorOrStringList errors) {
16-
super(message, code, statusCode, errors);
15+
public BadRequestError(final String message, final String code, FieldErrorOrStringList errors, final int statusCode) {
16+
super(message, code, errors, statusCode);
1717
}
1818
}

src/main/java/com/easypost/exception/API/ForbiddenError.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ public class ForbiddenError extends APIException {
99
*
1010
* @param message the exception message
1111
* @param code the exception code
12-
* @param statusCode the exception status code
1312
* @param errors the errors array
13+
* @param statusCode the exception status code
1414
*/
15-
public ForbiddenError(final String message, final String code, final int statusCode, FieldErrorOrStringList errors) {
16-
super(message, code, statusCode, errors);
15+
public ForbiddenError(final String message, final String code, FieldErrorOrStringList errors, final int statusCode) {
16+
super(message, code, errors, statusCode);
1717
}
1818
}

src/main/java/com/easypost/exception/API/GatewayTimeoutError.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ public class GatewayTimeoutError extends APIException {
99
*
1010
* @param message the exception message
1111
* @param code the exception code
12-
* @param statusCode the exception status code
1312
* @param errors the errors array
13+
* @param statusCode the exception status code
1414
*/
15-
public GatewayTimeoutError(final String message, final String code, final int statusCode, FieldErrorOrStringList errors) {
16-
super(message, code, statusCode, errors);
15+
public GatewayTimeoutError(final String message, final String code, FieldErrorOrStringList errors, final int statusCode) {
16+
super(message, code, errors, statusCode);
1717
}
1818
}

src/main/java/com/easypost/exception/API/InternalServerError.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ public class InternalServerError extends APIException {
99
*
1010
* @param message the exception message
1111
* @param code the exception code
12-
* @param statusCode the exception status code
1312
* @param errors the errors array
13+
* @param statusCode the exception status code
1414
*/
15-
public InternalServerError(final String message, final String code, final int statusCode, FieldErrorOrStringList errors) {
16-
super(message, code, statusCode, errors);
15+
public InternalServerError(final String message, final String code, FieldErrorOrStringList errors, final int statusCode) {
16+
super(message, code, errors, statusCode);
1717
}
1818
}

src/main/java/com/easypost/exception/API/InvalidRequestError.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ public class InvalidRequestError extends APIException {
99
*
1010
* @param message the exception message
1111
* @param code the exception code
12-
* @param statusCode the exception status code
1312
* @param errors the errors array
13+
* @param statusCode the exception status code
1414
*/
15-
public InvalidRequestError(final String message, final String code, final int statusCode, FieldErrorOrStringList errors) {
16-
super(message, code, statusCode, errors);
15+
public InvalidRequestError(final String message, final String code, FieldErrorOrStringList errors, final int statusCode) {
16+
super(message, code, errors, statusCode);
1717
}
1818
}

src/main/java/com/easypost/exception/API/MethodNotAllowedError.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ public class MethodNotAllowedError extends APIException {
99
*
1010
* @param message the exception message
1111
* @param code the exception code
12-
* @param statusCode the exception status code
1312
* @param errors the errors array
13+
* @param statusCode the exception status code
1414
*/
15-
public MethodNotAllowedError(final String message, final String code, final int statusCode, FieldErrorOrStringList errors) {
16-
super(message, code, statusCode, errors);
15+
public MethodNotAllowedError(final String message, final String code, FieldErrorOrStringList errors, final int statusCode) {
16+
super(message, code, errors, statusCode);
1717
}
1818
}

src/main/java/com/easypost/exception/API/NotFoundError.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ public class NotFoundError extends APIException {
99
*
1010
* @param message the exception message
1111
* @param code the exception code
12-
* @param statusCode the exception status code
1312
* @param errors the errors array
13+
* @param statusCode the exception status code
1414
*/
15-
public NotFoundError(final String message, final String code, final int statusCode, FieldErrorOrStringList errors) {
16-
super(message, code, statusCode, errors);
15+
public NotFoundError(final String message, final String code, FieldErrorOrStringList errors, final int statusCode) {
16+
super(message, code, errors, statusCode);
1717
}
1818
}

src/main/java/com/easypost/exception/API/PaymentError.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ public class PaymentError extends APIException {
99
*
1010
* @param message the exception message
1111
* @param code the exception code
12-
* @param statusCode the exception status code
1312
* @param errors the errors array
13+
* @param statusCode the exception status code
1414
*/
15-
public PaymentError(final String message, final String code, final int statusCode, FieldErrorOrStringList errors) {
16-
super(message, code, statusCode, errors);
15+
public PaymentError(final String message, final String code, FieldErrorOrStringList errors, final int statusCode) {
16+
super(message, code, errors, statusCode);
1717
}
1818
}

src/main/java/com/easypost/exception/API/RateLimitError.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ public class RateLimitError extends APIException {
99
*
1010
* @param message the exception message
1111
* @param code the exception code
12-
* @param statusCode the exception status code
1312
* @param errors the errors array
13+
* @param statusCode the exception status code
1414
*/
15-
public RateLimitError(final String message, final String code, final int statusCode, FieldErrorOrStringList errors) {
16-
super(message, code, statusCode, errors);
15+
public RateLimitError(final String message, final String code, FieldErrorOrStringList errors, final int statusCode) {
16+
super(message, code, errors, statusCode);
1717
}
1818
}

0 commit comments

Comments
 (0)