public class ElasticsearchException extends RuntimeException implements ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
Modifier and Type | Field and Description |
---|---|
static String |
REST_EXCEPTION_SKIP_CAUSE |
static boolean |
REST_EXCEPTION_SKIP_CAUSE_DEFAULT |
static String |
REST_EXCEPTION_SKIP_STACK_TRACE |
static boolean |
REST_EXCEPTION_SKIP_STACK_TRACE_DEFAULT |
EMPTY_PARAMS
Constructor and Description |
---|
ElasticsearchException(StreamInput in) |
ElasticsearchException(String msg,
Object... args)
Construct a
ElasticsearchException with the specified detail message. |
ElasticsearchException(String msg,
Throwable cause,
Object... args)
Construct a
ElasticsearchException with the specified detail message
and nested exception. |
ElasticsearchException(Throwable cause) |
Modifier and Type | Method and Description |
---|---|
void |
addHeader(String key,
List<String> value)
Adds a new header with the given key.
|
void |
addHeader(String key,
String... value)
Adds a new header with the given key.
|
protected void |
causeToXContent(XContentBuilder builder,
ToXContent.Params params)
Renders a cause exception as xcontent
|
boolean |
contains(Class exType)
Check whether this exception contains an exception of the given type:
either it is of the given class itself or it contains a nested cause
of the given type.
|
String |
getDetailedMessage()
Return the detail message, including the message from the nested exception
if there is one.
|
protected String |
getExceptionName() |
static String |
getExceptionName(Throwable ex)
Returns a underscore case name for the given exception.
|
List<String> |
getHeader(String key)
Returns the list of header values for the given key or
null if not header for the
given key exists. |
Set<String> |
getHeaderKeys()
Returns a set of all header keys on this exception
|
static int |
getId(Class<? extends ElasticsearchException> exception)
Returns the serialization id the given exception.
|
String |
getIndex() |
List<String> |
getResourceId() |
String |
getResourceType() |
Throwable |
getRootCause()
Retrieve the innermost cause of this exception, if none, returns the current exception.
|
ShardId |
getShardId() |
ElasticsearchException[] |
guessRootCauses()
Returns the root cause of this exception or mupltiple if different shards caused different exceptions
|
static ElasticsearchException[] |
guessRootCauses(Throwable t)
Returns the root cause of this exception or mupltiple if different shards caused different exceptions.
|
protected void |
innerToXContent(XContentBuilder builder,
ToXContent.Params params)
Renders additional per exception information into the xcontent
|
static boolean |
isRegistered(Class<? extends Throwable> exception)
Retruns
true iff the given class is a registered for an exception to be read. |
static ElasticsearchException |
readException(StreamInput input,
int id) |
static <T extends Throwable> |
readStackTrace(T throwable,
StreamInput in)
Deserializes stacktrace elements as well as suppressed exceptions from the given output stream and
adds it to the given exception.
|
protected void |
renderHeader(XContentBuilder builder,
ToXContent.Params params) |
static void |
renderThrowable(XContentBuilder builder,
ToXContent.Params params,
Throwable t) |
void |
setIndex(Index index) |
void |
setIndex(String index) |
void |
setResources(String type,
String... id) |
void |
setShard(ShardId shardId) |
RestStatus |
status()
Returns the rest status code associated with this exception.
|
String |
toString() |
XContentBuilder |
toXContent(XContentBuilder builder,
ToXContent.Params params) |
static void |
toXContent(XContentBuilder builder,
ToXContent.Params params,
Throwable ex)
Statis toXContent helper method that also renders non
ElasticsearchException instances as XContent. |
Throwable |
unwrapCause()
Unwraps the actual cause from the exception for cases when the exception is a
ElasticsearchWrapperException . |
static <T extends Throwable> |
writeStackTraces(T throwable,
StreamOutput out)
Serializes the given exceptions stacktrace elements as well as it's suppressed exceptions to the given output stream.
|
void |
writeTo(StreamOutput out) |
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
public static final String REST_EXCEPTION_SKIP_CAUSE
public static final String REST_EXCEPTION_SKIP_STACK_TRACE
public static final boolean REST_EXCEPTION_SKIP_STACK_TRACE_DEFAULT
public static final boolean REST_EXCEPTION_SKIP_CAUSE_DEFAULT
public ElasticsearchException(Throwable cause)
public ElasticsearchException(String msg, Object... args)
ElasticsearchException
with the specified detail message.
The message can be parameterized using {}
as placeholders for the given
argumentsmsg
- the detail messageargs
- the arguments for the messagepublic ElasticsearchException(String msg, Throwable cause, Object... args)
ElasticsearchException
with the specified detail message
and nested exception.
The message can be parameterized using {}
as placeholders for the given
argumentsmsg
- the detail messagecause
- the nested exceptionargs
- the arguments for the messagepublic ElasticsearchException(StreamInput in) throws IOException
IOException
public void addHeader(String key, String... value)
public void addHeader(String key, List<String> value)
public List<String> getHeader(String key)
null
if not header for the
given key exists.public RestStatus status()
public Throwable unwrapCause()
ElasticsearchWrapperException
.public String getDetailedMessage()
public Throwable getRootCause()
public boolean contains(Class exType)
exType
- the exception type to look forpublic void writeTo(StreamOutput out) throws IOException
IOException
public static ElasticsearchException readException(StreamInput input, int id) throws IOException
IOException
public static boolean isRegistered(Class<? extends Throwable> exception)
true
iff the given class is a registered for an exception to be read.public static int getId(Class<? extends ElasticsearchException> exception)
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException
toXContent
in interface ToXContent
IOException
protected void innerToXContent(XContentBuilder builder, ToXContent.Params params) throws IOException
IOException
protected void causeToXContent(XContentBuilder builder, ToXContent.Params params) throws IOException
IOException
protected final void renderHeader(XContentBuilder builder, ToXContent.Params params) throws IOException
IOException
public static void toXContent(XContentBuilder builder, ToXContent.Params params, Throwable ex) throws IOException
ElasticsearchException
instances as XContent.IOException
public ElasticsearchException[] guessRootCauses()
public static ElasticsearchException[] guessRootCauses(Throwable t)
ElasticsearchException
an empty array
is returned.protected String getExceptionName()
public static String getExceptionName(Throwable ex)
public static <T extends Throwable> T readStackTrace(T throwable, StreamInput in) throws IOException
IOException
public static <T extends Throwable> T writeStackTraces(T throwable, StreamOutput out) throws IOException
IOException
public String getIndex()
public ShardId getShardId()
public void setIndex(Index index)
public void setIndex(String index)
public void setShard(ShardId shardId)
public String getResourceType()
public static void renderThrowable(XContentBuilder builder, ToXContent.Params params, Throwable t) throws IOException
IOException
Copyright © 2009–2016. All rights reserved.