@Test public void fetchDetailsWithSearchPhaseExecutionException() { when(searchPhaseExecutionException.shardFailures()) .thenReturn(new ShardSearchFailure[] {shardSearchFailure}); when(shardSearchFailure.shardId()).thenReturn(1); when(shardSearchFailure.getCause()).thenReturn(new IllegalStateException("illegal state")); ElasticsearchErrorMessage errorMessage = new ElasticsearchErrorMessage(searchPhaseExecutionException, SERVICE_UNAVAILABLE.getStatus()); assertEquals("Shard[1]: java.lang.IllegalStateException: illegal state\n" + "\n" + "For more details, please send request for Json format to see the " + "raw response from elasticsearch engine.", errorMessage.fetchDetails()); }
@Override protected String fetchDetails() { StringBuilder details = new StringBuilder(); if (exception instanceof SearchPhaseExecutionException) { details.append( fetchSearchPhaseExecutionExceptionDetails((SearchPhaseExecutionException) exception)); } else { details.append(((ElasticsearchException) exception).getDetailedMessage()); } details.append( "\nFor more details, please send request for Json format to see the raw response from " + "elasticsearch engine."); return details.toString(); }
ElasticsearchErrorMessage extends ErrorMessage { @Override protected String fetchDetails() { StringBuilder details = new StringBuilder(); if (exception instanceof SearchPhaseExecutionException) { details.append( fetchSearchPhaseExecutionExceptionDetails((SearchPhaseExecutionException) exception)); } else { details.append(((ElasticsearchException) exception).getDetailedMessage()); } details.append( "\nFor more details, please send request for Json format to see the raw response from " + "elasticsearch engine."); return details.toString(); } }
ElasticsearchErrorMessage extends ErrorMessage { @Override protected String fetchDetails() { StringBuilder details = new StringBuilder(); if (exception instanceof SearchPhaseExecutionException) { details.append( fetchSearchPhaseExecutionExceptionDetails((SearchPhaseExecutionException) exception)); } else { details.append(((ElasticsearchException) exception).getDetailedMessage()); } details.append( "\nFor more details, please send request for Json format to see the raw response from " + "elasticsearch engine."); return details.toString(); } ElasticsearchErrorMessage(ElasticsearchException exception, int status); }
ElasticsearchErrorMessage extends ErrorMessage { @Override protected String fetchDetails() { StringBuilder details = new StringBuilder(); if (exception instanceof SearchPhaseExecutionException) { details.append( fetchSearchPhaseExecutionExceptionDetails((SearchPhaseExecutionException) exception)); } else { details.append(((ElasticsearchException) exception).getDetailedMessage()); } details.append( "\nFor more details, please send request for Json format to see the raw response from " + "elasticsearch engine."); return details.toString(); } ElasticsearchErrorMessage(ElasticsearchException exception, int status);  }
ElasticsearchErrorMessage extends ErrorMessage { @Override protected String fetchDetails() { StringBuilder details = new StringBuilder(); if (exception instanceof SearchPhaseExecutionException) { details.append( fetchSearchPhaseExecutionExceptionDetails((SearchPhaseExecutionException) exception)); } else { details.append(((ElasticsearchException) exception).getDetailedMessage()); } details.append( "\nFor more details, please send request for Json format to see the raw response from " + "elasticsearch engine."); return details.toString(); } ElasticsearchErrorMessage(ElasticsearchException exception, int status);   }