public class DocumentStoreOperationException extends Exception {
- private static final long serialVersionUID = -7689309913743200670L;
+ private static final long serialVersionUID = -7689309913743200670L;
- public DocumentStoreOperationException(String message, Exception ex) {
- super(message, ex);
- }
+ public enum ErrorMessage {
+ NO_RESPONSE_CODE(
+ "Failed to get the response code from the connection."
+ ),
+ SET_REQUEST_METHOD_FAILED(
+ "Failed to set HTTP request method to %s."
+ );
+ private String message;
- public DocumentStoreOperationException(String message) {
- super(message);
- }
+ ErrorMessage(String msg) {
+ this.message = msg;
+ }
+ }
+
+ public DocumentStoreOperationException(ErrorMessage error, Exception ex, Object... args) {
+ super(String.format(error.message, args), ex);
+ }
+
+ public DocumentStoreOperationException(String message, Exception ex) {
+ super(message, ex);
+ }
+
+ public DocumentStoreOperationException(String message) {
+ super(message);
+ }
}