public void setException(Exception exception) {
    if (hasUnhandledException) {
      hasUnhandledException = false;
      throw new IllegalStateException("Unhandled exception in Context", this.exception);
    }

    this.exception = exception;
    hasUnhandledException = true;
  }
Sets the exception or throws an IllegalStateException if the context already contains an
exception that hasn't been retrieved via getException().
integ-tests/src/cucumberTest/java/cucumber/steps/helpers/ExceptionContext.java