diff options
author | Jesse Morgan <jesse@jesterpm.net> | 2016-03-19 02:05:33 -0700 |
---|---|---|
committer | Jesse Morgan <jesse@jesterpm.net> | 2016-03-19 02:07:24 -0700 |
commit | b9eb1329a6dbec7b75c21d8e0eb13134121db6bb (patch) | |
tree | fec73ab32ff625c304513c24e864809845eede1a /src/main/java/com/p4square/ccbapi/exception |
Initial commit for the CCB API Client.
The client currently supports the following APIs:
* individual_profiles
* individual_profile_from_id
* individual_profile_from_login_password
* individual_profile_from_micr
* custom_field_labels
Diffstat (limited to 'src/main/java/com/p4square/ccbapi/exception')
4 files changed, 66 insertions, 0 deletions
diff --git a/src/main/java/com/p4square/ccbapi/exception/CCBErrorResponseException.java b/src/main/java/com/p4square/ccbapi/exception/CCBErrorResponseException.java new file mode 100644 index 0000000..dd13f75 --- /dev/null +++ b/src/main/java/com/p4square/ccbapi/exception/CCBErrorResponseException.java @@ -0,0 +1,24 @@ +package com.p4square.ccbapi.exception; + +import com.p4square.ccbapi.model.CCBErrorResponse; + +import java.util.List; + +/** + * CCBErrorResponseException is thrown when the CCB API returns one or more error responses. + */ +public class CCBErrorResponseException extends CCBException { + private final List<CCBErrorResponse> errors; + + public CCBErrorResponseException(List<CCBErrorResponse> errors) { + super("CCB API service responded with errors: " + errors); + this.errors = errors; + } + + /** + * @return The error response returned by the service. + */ + public List<CCBErrorResponse> getErrors() { + return errors; + } +} diff --git a/src/main/java/com/p4square/ccbapi/exception/CCBException.java b/src/main/java/com/p4square/ccbapi/exception/CCBException.java new file mode 100644 index 0000000..6d74ea4 --- /dev/null +++ b/src/main/java/com/p4square/ccbapi/exception/CCBException.java @@ -0,0 +1,16 @@ +package com.p4square.ccbapi.exception; + +import java.io.IOException; + +/** + * Common exception class for all CCB API library exceptions. + */ +public class CCBException extends IOException { + public CCBException(String message) { + super(message); + } + + public CCBException(String message, Throwable cause) { + super(message, cause); + } +} diff --git a/src/main/java/com/p4square/ccbapi/exception/CCBParseException.java b/src/main/java/com/p4square/ccbapi/exception/CCBParseException.java new file mode 100644 index 0000000..aee0e34 --- /dev/null +++ b/src/main/java/com/p4square/ccbapi/exception/CCBParseException.java @@ -0,0 +1,14 @@ +package com.p4square.ccbapi.exception; + +/** + * CCBParseException is thrown when a response from CCB cannot be parsed. + */ +public class CCBParseException extends CCBException { + public CCBParseException(String message) { + super(message); + } + + public CCBParseException(String message, Throwable cause) { + super(message, cause); + } +} diff --git a/src/main/java/com/p4square/ccbapi/exception/CCBRetryableErrorException.java b/src/main/java/com/p4square/ccbapi/exception/CCBRetryableErrorException.java new file mode 100644 index 0000000..c222662 --- /dev/null +++ b/src/main/java/com/p4square/ccbapi/exception/CCBRetryableErrorException.java @@ -0,0 +1,12 @@ +package com.p4square.ccbapi.exception; + +/** + * CCBRetryableErrorException is thrown when a retryable error is received. + * + * The caller may retry the request with an appropriate back-off. + */ +public class CCBRetryableErrorException extends CCBException { + public CCBRetryableErrorException(final String message) { + super(message); + } +} |