Search in sources :

Example 1 with SearchException

use of org.elasticsearch.search.SearchException in project elasticsearch by elastic.

the class ExceptionSerializationTests method testSearchException.

public void testSearchException() throws IOException {
    SearchShardTarget target = new SearchShardTarget("foo", new Index("bar", "_na_"), 1);
    SearchException ex = serialize(new SearchException(target, "hello world"));
    assertEquals(target, ex.shard());
    assertEquals(ex.getMessage(), "hello world");
    ex = serialize(new SearchException(null, "hello world", new NullPointerException()));
    assertNull(ex.shard());
    assertEquals(ex.getMessage(), "hello world");
    assertTrue(ex.getCause() instanceof NullPointerException);
}
Also used : SearchShardTarget(org.elasticsearch.search.SearchShardTarget) SearchException(org.elasticsearch.search.SearchException) Index(org.elasticsearch.index.Index)

Aggregations

Index (org.elasticsearch.index.Index)1 SearchException (org.elasticsearch.search.SearchException)1 SearchShardTarget (org.elasticsearch.search.SearchShardTarget)1