@Test public void esExceptionShouldCreateEsErrorMessage() { Exception exception = new ElasticsearchException(nonEsThrowable); ErrorMessage msg = ErrorMessageFactory.createErrorMessage(exception, RestStatus.BAD_REQUEST.getStatus()); assertTrue(msg instanceof ElasticsearchErrorMessage); }
public static ErrorMessage createErrorMessage(Exception e, int status) { Throwable cause = unwrapCause(e); if (cause instanceof ElasticsearchException) { ElasticsearchException exception = (ElasticsearchException) cause; return new ElasticsearchErrorMessage(exception, exception.status().getStatus()); } return new ErrorMessage(e, status); }
ErrorMessageFactory { public static ErrorMessage createErrorMessage(Exception e, int status) { Throwable cause = unwrapCause(e); if (cause instanceof ElasticsearchException) { ElasticsearchException exception = (ElasticsearchException) cause; return new ElasticsearchErrorMessage(exception, exception.status().getStatus()); } return new ErrorMessage(e, status); } }
ErrorMessageFactory { public static ErrorMessage createErrorMessage(Exception e, int status) { Throwable cause = unwrapCause(e); if (cause instanceof ElasticsearchException) { ElasticsearchException exception = (ElasticsearchException) cause; return new ElasticsearchErrorMessage(exception, exception.status().getStatus()); } return new ErrorMessage(e, status); }  }
ErrorMessageFactory { public static ErrorMessage createErrorMessage(Exception e, int status) { Throwable cause = unwrapCause(e); if (cause instanceof ElasticsearchException) { ElasticsearchException exception = (ElasticsearchException) cause; return new ElasticsearchErrorMessage(exception, exception.status().getStatus()); } return new ErrorMessage(e, status); }  static ErrorMessage createErrorMessage(Exception e, int status); }
ErrorMessageFactory { public static ErrorMessage createErrorMessage(Exception e, int status) { Throwable cause = unwrapCause(e); if (cause instanceof ElasticsearchException) { ElasticsearchException exception = (ElasticsearchException) cause; return new ElasticsearchErrorMessage(exception, exception.status().getStatus()); } return new ErrorMessage(e, status); }  static ErrorMessage createErrorMessage(Exception e, int status);  }