Class JException

All Implemented Interfaces:
Serializable

public class JException extends RuntimeException
See Also:
  • Constructor Details

    • JException

      public JException(String error)
    • JException

      public JException(String error, int location)
    • JException

      public JException(String error, int location, Object currentToken)
    • JException

      public JException(String error, int location, Object currentToken, Object expected)
    • JException

      public JException(Throwable cause, String error, int location, Object currentToken, Object expected)
  • Method Details

    • getError

      public String getError()
      Returns the error code, i.e. S0201
      Returns:
    • getLocation

      public int getLocation()
      Returns the error location (in characters)
      Returns:
    • getCurrent

      public Object getCurrent()
      Returns the current token
      Returns:
    • getExpected

      public Object getExpected()
      Returns the expected token
      Returns:
    • getDetailedErrorMessage

      public String getDetailedErrorMessage()
      Returns the error message with error details in the text. Example: Syntax error: ")" {code=S0201 position=3}
      Returns:
    • msg

      public static String msg(String error, int location, Object arg1, Object arg2)
      Generate error message from given error code Codes are defined in Jsonata.errorCodes Fallback: if error code does not exist, return a generic message
      Parameters:
      error -
      location -
      arg1 -
      arg2 -
      Returns:
    • msg

      public static String msg(String error, int location, Object arg1, Object arg2, boolean details)
      Generate error message from given error code Codes are defined in Jsonata.errorCodes Fallback: if error code does not exist, return a generic message
      Parameters:
      error -
      location -
      arg1 -
      arg2 -
      details - True = add error details as text, false = don't add details (use getters to retrieve details)
      Returns: