Search in sources :

Example 1 with ExceptionWrapper

use of org.apache.drill.exec.proto.UserBitShared.ExceptionWrapper in project drill by apache.

the class TestDrillbitResilience method assertExceptionMessage.

/**
   * Check that the injected exception is what we were expecting.
   *
   * @param throwable      the throwable that was caught (by the test)
   * @param exceptionClass the expected exception class
   * @param desc           the expected exception site description
   */
private static void assertExceptionMessage(final Throwable throwable, final Class<? extends Throwable> exceptionClass, final String desc) {
    assertTrue("Throwable was not of UserException type.", throwable instanceof UserException);
    final ExceptionWrapper cause = ((UserException) throwable).getOrCreatePBError(false).getException();
    assertEquals("Exception class names should match.", exceptionClass.getName(), cause.getExceptionClass());
    assertEquals("Exception sites should match.", desc, cause.getMessage());
}
Also used : UserException(org.apache.drill.common.exceptions.UserException) ExceptionWrapper(org.apache.drill.exec.proto.UserBitShared.ExceptionWrapper)

Aggregations

UserException (org.apache.drill.common.exceptions.UserException)1 ExceptionWrapper (org.apache.drill.exec.proto.UserBitShared.ExceptionWrapper)1