Class ExceptionUtils

java.lang.Object
org.elasticsearch.xpack.esql.ExceptionUtils

public class ExceptionUtils extends Object
  • Constructor Details

    • ExceptionUtils

      public ExceptionUtils()
  • Method Details

    • math

      public static VerificationException math(Source source, ArithmeticException e)
      Create a VerificationException from an ArithmeticException thrown because of an invalid math expression.
      Parameters:
      source - the invalid part of the query causing the exception
      e - the exception that was thrown
      Returns:
      an exception with a user-readable error message with http code 400
    • assertIllegalState

      public static void assertIllegalState(Boolean condition, String message)
      We generally prefer to avoid assertions in production code, as they can kill the entire node if they fail, instead of just failing a given test. So instead, we throw an IllegalStateException. Like proper asserts, this will only be executed if assertions are enabled.
    • assertIllegalState

      public static void assertIllegalState(Supplier<Boolean> condition, String message)
      We generally prefer to avoid assertions in production code, as they can kill the entire node if they fail, instead of just failing a given test. So instead, we throw an IllegalStateException. Like proper asserts, this will only be executed if assertions are enabled.