Package org.elasticsearch.script
Class ScriptException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
org.elasticsearch.ElasticsearchException
org.elasticsearch.script.ScriptException
- All Implemented Interfaces:
java.io.Serializable
,Writeable
,org.elasticsearch.common.xcontent.ToXContent
,org.elasticsearch.common.xcontent.ToXContentFragment
public class ScriptException extends ElasticsearchException
Exception from a scripting engine.
A ScriptException has the following components:
message
: A short and simple summary of what happened, such as "compile error".cause
: The underlying cause of the exception.scriptStack
: An implementation-specific "stacktrace" for the error in the script.script
: Identifier for which script failed.lang
: Scripting engine language, such as "painless"
- See Also:
- Serialized Form
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ScriptException.Position
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
org.elasticsearch.common.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.common.xcontent.ToXContent.MapParams, org.elasticsearch.common.xcontent.ToXContent.Params
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V>
-
Field Summary
Fields inherited from class org.elasticsearch.ElasticsearchException
REST_EXCEPTION_SKIP_STACK_TRACE, REST_EXCEPTION_SKIP_STACK_TRACE_DEFAULT, STACK_TRACE
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
-
Constructor Summary
Constructors Constructor Description ScriptException(java.lang.String message, java.lang.Throwable cause, java.util.List<java.lang.String> scriptStack, java.lang.String script, java.lang.String lang)
Create a new ScriptException with null Position.ScriptException(java.lang.String message, java.lang.Throwable cause, java.util.List<java.lang.String> scriptStack, java.lang.String script, java.lang.String lang, ScriptException.Position pos)
Create a new ScriptException.ScriptException(StreamInput in)
Deserializes a ScriptException from aStreamInput
-
Method Summary
Modifier and Type Method Description java.lang.String
getLang()
Returns the language of the script.ScriptException.Position
getPos()
Returns the position of the error.java.lang.String
getScript()
Returns the identifier for which script.java.util.List<java.lang.String>
getScriptStack()
Returns the stacktrace for the error in the script.protected void
metadataToXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)
Renders additional per exception information into the XContentRestStatus
status()
Returns the rest status code associated with this exception.java.lang.String
toJsonString()
Returns a JSON version of this exception for debugging.void
writeTo(StreamOutput out)
Write this into the StreamOutput.Methods inherited from class org.elasticsearch.ElasticsearchException
addHeader, addHeader, addMetadata, addMetadata, failureFromXContent, fromXContent, generateFailureXContent, generateThrowableXContent, getDetailedMessage, getExceptionName, getExceptionName, getHeader, getHeaderKeys, getHeaders, getId, getIndex, getMetadata, getMetadata, getMetadataKeys, getResourceId, getResourceType, getRootCause, getShardId, guessRootCauses, guessRootCauses, innerFromXContent, innerToXContent, isRegistered, readException, readStackTrace, setIndex, setIndex, setResources, setShard, toString, toXContent, unwrapCause, writeStackTraces
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentFragment
isFragment
-
Constructor Details
-
ScriptException
public ScriptException(java.lang.String message, java.lang.Throwable cause, java.util.List<java.lang.String> scriptStack, java.lang.String script, java.lang.String lang, ScriptException.Position pos)Create a new ScriptException.- Parameters:
message
- A short and simple summary of what happened, such as "compile error". Must not benull
.cause
- The underlying cause of the exception. Must not benull
.scriptStack
- An implementation-specific "stacktrace" for the error in the script. Must not benull
, but can be empty (though this should be avoided if possible).script
- Identifier for which script failed. Must not benull
.lang
- Scripting engine language, such as "painless". Must not benull
.pos
- Position of error within script, may benull
.- Throws:
java.lang.NullPointerException
- if any parameters arenull
except pos.
-
ScriptException
public ScriptException(java.lang.String message, java.lang.Throwable cause, java.util.List<java.lang.String> scriptStack, java.lang.String script, java.lang.String lang)Create a new ScriptException with null Position. -
ScriptException
Deserializes a ScriptException from aStreamInput
- Throws:
java.io.IOException
-
-
Method Details
-
writeTo
Description copied from interface:Writeable
Write this into the StreamOutput.- Specified by:
writeTo
in interfaceWriteable
- Overrides:
writeTo
in classElasticsearchException
- Throws:
java.io.IOException
-
metadataToXContent
protected void metadataToXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws java.io.IOExceptionDescription copied from class:ElasticsearchException
Renders additional per exception information into the XContent- Overrides:
metadataToXContent
in classElasticsearchException
- Throws:
java.io.IOException
-
getScriptStack
public java.util.List<java.lang.String> getScriptStack()Returns the stacktrace for the error in the script.- Returns:
- a read-only list of frames, which may be empty.
-
getScript
public java.lang.String getScript()Returns the identifier for which script.- Returns:
- script's name or source text that identifies the script.
-
getLang
public java.lang.String getLang()Returns the language of the script.- Returns:
- the
lang
parameter of the scripting engine.
-
getPos
Returns the position of the error. -
toJsonString
public java.lang.String toJsonString()Returns a JSON version of this exception for debugging. -
status
Description copied from class:ElasticsearchException
Returns the rest status code associated with this exception.- Overrides:
status
in classElasticsearchException
-