Class ScriptException

org.elasticsearch.ElasticsearchException
org.elasticsearch.script.ScriptException
All Implemented Interfaces:
, 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
  • Constructor Details

    • ScriptException

      public ScriptException( message,  cause, <> scriptStack,  script,  lang, ScriptException.Position pos)
      Create a new ScriptException.
      Parameters:
      message - A short and simple summary of what happened, such as "compile error". Must not be null.
      cause - The underlying cause of the exception. Must not be null.
      scriptStack - An implementation-specific "stacktrace" for the error in the script. Must not be null, but can be empty (though this should be avoided if possible).
      script - Identifier for which script failed. Must not be null.
      lang - Scripting engine language, such as "painless". Must not be null.
      pos - Position of error within script, may be null.
      Throws:
      - if any parameters are null except pos.
    • ScriptException

      public ScriptException( message,  cause, <> scriptStack,  script,  lang)
      Create a new ScriptException with null Position.
    • ScriptException

      public ScriptException(StreamInput in) throws
      Deserializes a ScriptException from a StreamInput
      Throws:
  • Method Details

    • writeTo

      public void writeTo(StreamOutput out) throws
      Description copied from interface: Writeable
      Write this into the StreamOutput.
      Specified by:
      writeTo in interface Writeable
      Overrides:
      writeTo in class ElasticsearchException
      Throws:
    • metadataToXContent

      protected void metadataToXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws
      Description copied from class: ElasticsearchException
      Renders additional per exception information into the XContent
      Overrides:
      metadataToXContent in class ElasticsearchException
      Throws:
    • getScriptStack

      public <> getScriptStack()
      Returns the stacktrace for the error in the script.
      Returns:
      a read-only list of frames, which may be empty.
    • getScript

      public  getScript()
      Returns the identifier for which script.
      Returns:
      script's name or source text that identifies the script.
    • getLang

      public  getLang()
      Returns the language of the script.
      Returns:
      the lang parameter of the scripting engine.
    • getPos

      public ScriptException.Position getPos()
      Returns the position of the error.
    • toJsonString

      public  toJsonString()
      Returns a JSON version of this exception for debugging.
    • status

      public RestStatus status()
      Description copied from class: ElasticsearchException
      Returns the rest status code associated with this exception.
      Overrides:
      status in class ElasticsearchException