Package org.apache.solr.common
Class SolrException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
org.apache.solr.common.SolrException
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
CloudSolrClient.RouteException,NonExistentCoreException,RemoteSolrException,SolrErrorWrappingException
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThis list of valid HTTP Status error codes that Solr may return when there is a "Server Side" error. -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedSolrException(int code, String msg, Throwable th) Constructor that can set arbitrary http status code.SolrException(SolrException.ErrorCode code, String msg) SolrException(SolrException.ErrorCode code, String msg, Throwable th) SolrException(SolrException.ErrorCode code, Throwable th) -
Method Summary
Modifier and TypeMethodDescriptionintcode()The HTTP Status code associated with this Exception.getMetadata(String key) static ThrowablevoidlogDebugWithMdc(org.slf4j.Logger logger, String msg) voidlogInfoWithMdc(org.slf4j.Logger logger, String msg) voidlogWarnWithMdc(org.slf4j.Logger logger, String msg) voidsetDetails(List<Map<String, Object>> details) voidsetMetadata(String key, String value) voidsetMetadata(NamedList<String> metadata) static SolrExceptionEnsure that the provided tragic exception is wrapped in a 5xx SolrExceptionMethods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Field Details
-
metadata
-
details
-
-
Constructor Details
-
SolrException
-
SolrException
-
SolrException
-
SolrException
Constructor that can set arbitrary http status code. Not for use in Solr, but may be used by clients in subclasses to capture errors returned by the servlet container or other HTTP proxies.
-
-
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 validSolrException.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
-
getMetadata
-
getMetadata
-
setMetadata
-
setDetails
-
getDetails
-
getResponseMessage
-
getThrowable
-
getRootThrowable
-
getRootCause
-
wrapLuceneTragicExceptionIfNecessary
Ensure that the provided tragic exception is wrapped in a 5xx SolrExceptionTragic 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.
-
logInfoWithMdc
-
logDebugWithMdc
-
logWarnWithMdc
-