Class SolrException

All Implemented Interfaces:
Serializable
Direct Known Subclasses:
CloudSolrClient.RouteException, NonExistentCoreException, RemoteSolrException, SolrErrorWrappingException

public class SolrException extends RuntimeException
See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • code

      public int code()
      The HTTP Status code associated with this Exception. For SolrExceptions thrown by Solr "Server Side", this should be a valid SolrException.ErrorCode, however client side exceptions may contain an arbitrary error code based on the behavior of the Servlet Container hosting Solr, or any HTTP Proxies that may exist between the client and the server.
      Returns:
      The HTTP Status code associated with this Exception
    • setMetadata

      public void setMetadata(NamedList<String> metadata)
    • getMetadata

      public NamedList<String> getMetadata()
    • getMetadata

      public String getMetadata(String key)
    • setMetadata

      public void setMetadata(String key, String value)
    • setDetails

      public void setDetails(List<Map<String,Object>> details)
    • getDetails

      public List<Map<String,Object>> getDetails()
    • getResponseMessage

      public String getResponseMessage()
    • getThrowable

      public String getThrowable()
    • getRootThrowable

      public String getRootThrowable()
    • getRootCause

      public static Throwable getRootCause(Throwable t)
    • hasCause

      public static boolean hasCause(Throwable t, Class<? extends Throwable> type)
      Whether t or anything in its cause chain is of the given type. Prefer this to getRootCause(java.lang.Throwable) when classifying a failure, since a transport may report it wrapped at any depth.
    • wrapLuceneTragicExceptionIfNecessary

      public static SolrException wrapLuceneTragicExceptionIfNecessary(Exception e)
      Ensure that the provided tragic exception is wrapped in a 5xx SolrException

      Tragic exceptions (those that Lucene's IndexWriter uses to signify it has become inoperable) are expected to have a 5xx error code. This method takes an input tragic exception and adds the expected wrapper, if necessary.

      Parameters:
      e - the exception to check the code on. If not a SolrException, then this method acts as a no-op.