public Throwable getFailureException() {
    if (failureException == null) {
      return new IoTDBException(getFailureStatus().getMessage(), getFailureStatus().code);
    } else {
      return failureException;
    }
  }
State machine for a {@link QueryExecution}. It stores the states for the {@link QueryExecution}.
Others can register listeners when the state changes of the {@link QueryExecution}.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/QueryStateMachine.java