use of com.yahoo.processing.request.ErrorMessage in project vespa by vespa-engine.
the class SearchRendererAdaptor method simpleRenderErrorHit.
/**
* Renders this hit as XML, disregarding the given template.
* The main error will be rendered first, the all the following errors.
*/
public boolean simpleRenderErrorHit(Writer writer, com.yahoo.search.result.ErrorHit errorHit) throws IOException {
XMLWriter xmlWriter = (writer instanceof XMLWriter) ? (XMLWriter) writer : new XMLWriter(writer, 10, -1);
xmlWriter.openTag("errordetails");
for (Iterator i = errorHit.errorIterator(); i.hasNext(); ) {
ErrorMessage error = (ErrorMessage) i.next();
rendererErrorHitMessageMessage(xmlWriter, errorHit, error);
}
xmlWriter.closeTag();
return true;
}
use of com.yahoo.processing.request.ErrorMessage in project vespa by vespa-engine.
the class WandSearcherTestCase method requireThatErrorIsReturnedOnInvalidTokenList.
@Test
public void requireThatErrorIsReturnedOnInvalidTokenList() {
Query q = buildQuery(VESPA_FIELD, "{a1,b:1}", null, null, null, null);
Result r = exec.search(q);
ErrorMessage msg = r.hits().getError();
assertNotNull(msg);
assertEquals(INVALID_QUERY_PARAMETER.code, msg.getCode());
assertEquals("'{a1,b:1}' is not a legal sparse vector string: Expected ':' starting at position 3 but was ','", msg.getDetailedMessage());
}
use of com.yahoo.processing.request.ErrorMessage in project vespa by vespa-engine.
the class WandSearcherTestCase method requireThatErrorIsReturnedOnUnknownField.
@Test
public void requireThatErrorIsReturnedOnUnknownField() {
Query q = buildDefaultQuery("unknown", "50");
Result r = exec.search(q);
ErrorMessage msg = r.hits().getError();
assertNotNull(msg);
assertEquals(INVALID_QUERY_PARAMETER.code, msg.getCode());
assertEquals("Field 'unknown' was not found in index facts for search definitions [test]", msg.getDetailedMessage());
}
use of com.yahoo.processing.request.ErrorMessage in project vespa by vespa-engine.
the class RequestTestCase method testErrorMessages.
@Test
public void testErrorMessages() {
Request r = new Request();
r.errors().add(new ErrorMessage("foo"));
r.errors().add(new ErrorMessage("bar"));
assertEquals(2, r.errors().size());
assertEquals("foo", r.errors().get(0).getMessage());
assertEquals("bar", r.errors().get(1).getMessage());
}
Aggregations