Class ScriptException

  • All Implemented Interfaces:
    java.io.Serializable, Writeable, ToXContent, 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 Detail

      • 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.
        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.
        Throws:
        java.lang.NullPointerException - if any parameters are null.
      • ScriptException

        public ScriptException​(StreamInput in)
                        throws java.io.IOException
        Deserializes a ScriptException from a StreamInput
        Throws:
        java.io.IOException
    • Method Detail

      • 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.
      • toJsonString

        public java.lang.String toJsonString()
        Returns a JSON version of this exception for debugging.