Example usage for org.apache.solr.common SolrException getMetadata

List of usage examples for org.apache.solr.common SolrException getMetadata

Introduction

In this page you can find the example usage for org.apache.solr.common SolrException getMetadata.

Prototype

public NamedList<String> getMetadata() 

Source Link

Usage

From source file:edu.harvard.gis.hhypermap.bop.SolrUpdateSlammer.java

License:Apache License

private void throwIfError() {
    if (failedException != null) {
        if (failedException instanceof SolrException) {
            SolrException exception = (SolrException) failedException;
            System.err.println(exception.getMetadata());
        }/*from w w  w . jav a2s.  co  m*/
        throw Throwables.propagate(failedException);
    }
}

From source file:org.vootoo.client.netty.util.ProtobufUtil.java

License:Apache License

public static int getErrorInfo(Throwable ex, SolrProtocol.ExceptionBody.Builder exceptionBody) {
    int code = 500;

    if (ex instanceof SolrException) {
        SolrException solrExc = (SolrException) ex;
        code = solrExc.code();//w w w .  j a v  a2  s  .  co  m
        fillErrorMetadata(exceptionBody, solrExc.getMetadata());
    }

    // add first has msg
    for (Throwable th = ex; th != null; th = th.getCause()) {
        String msg = th.getMessage();
        if (msg != null) {
            exceptionBody.setMessage(msg);
            break;
        }
    }

    //trace
    if (code == 500 || code < 100) {
        exceptionBody.setTrace(SolrException.toStr(ex));
        // non standard codes have undefined results with various servers
        if (code < 100) {
            code = 500;
        }
    }

    exceptionBody.setCode(code);

    return code;
}