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:
BaseCloudSolrClient.RouteException
,BaseHttpSolrClient.RemoteSolrException
,NonExistentCoreException
,ZooKeeperException
public class SolrException extends RuntimeException
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SolrException.ErrorCode
This list of valid HTTP Status error codes that Solr may return in the case of a "Server Side" error.
-
Field Summary
Fields Modifier and Type Field Description static String
ERROR_CLASS
static Set<String>
ignorePatterns
For test code - do not log exceptions that match any of these regular expressions.protected NamedList<String>
metadata
static String
ROOT_ERROR_CLASS
-
Constructor Summary
Constructors Modifier Constructor Description protected
SolrException(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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
code()
The HTTP Status code associated with this Exception.static String
doIgnore(Throwable t, String m)
Returns null if this exception does not match any ignore patterns, or a message string to use if it does.NamedList<String>
getMetadata()
String
getMetadata(String key)
static Throwable
getRootCause(Throwable t)
String
getRootThrowable()
String
getThrowable()
void
log(org.slf4j.Logger log)
static void
log(org.slf4j.Logger log, String msg)
static void
log(org.slf4j.Logger log, String msg, Throwable e)
static void
log(org.slf4j.Logger log, Throwable e)
void
logDebugWithMdc(org.slf4j.Logger logger, String msg)
void
logInfoWithMdc(org.slf4j.Logger logger, String msg)
void
logWarnWithMdc(org.slf4j.Logger logger, String msg)
void
setMetadata(String key, String value)
void
setMetadata(NamedList<String> metadata)
static String
toStr(Throwable e)
String
toString()
-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
-
-
-
-
Field Detail
-
ROOT_ERROR_CLASS
public static final String ROOT_ERROR_CLASS
- See Also:
- Constant Field Values
-
ERROR_CLASS
public static final String ERROR_CLASS
- See Also:
- Constant Field Values
-
ignorePatterns
public static Set<String> ignorePatterns
For test code - do not log exceptions that match any of these regular expressions. Ais recommended
.
-
-
Constructor Detail
-
SolrException
public SolrException(SolrException.ErrorCode code, String msg)
-
SolrException
public SolrException(SolrException.ErrorCode code, String msg, Throwable th)
-
SolrException
public SolrException(SolrException.ErrorCode code, Throwable th)
-
-
Method Detail
-
code
public int code()
The HTTP Status code associated with this Exception. For SolrExceptions thrown by Solr "Server Side", this should 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
-
getThrowable
public String getThrowable()
-
getRootThrowable
public String getRootThrowable()
-
log
public void log(org.slf4j.Logger log)
-
log
public static void log(org.slf4j.Logger log, Throwable e)
-
log
public static void log(org.slf4j.Logger log, String msg)
-
doIgnore
public static String doIgnore(Throwable t, String m)
Returns null if this exception does not match any ignore patterns, or a message string to use if it does.
-
logInfoWithMdc
public void logInfoWithMdc(org.slf4j.Logger logger, String msg)
-
logDebugWithMdc
public void logDebugWithMdc(org.slf4j.Logger logger, String msg)
-
logWarnWithMdc
public void logWarnWithMdc(org.slf4j.Logger logger, String msg)
-
-