@Override
  public List<SnowflakeIdentifier> listDatabases() {
    List<SnowflakeIdentifier> databases;
    try {
      databases =
          connectionPool.run(
              conn ->
                  queryHarness.query(
                      conn, "SHOW DATABASES IN ACCOUNT", DATABASE_RESULT_SET_HANDLER));
    } catch (SQLException e) {
      throw snowflakeExceptionToIcebergException(
          SnowflakeIdentifier.ofRoot(), e, "Failed to list databases");
    } catch (InterruptedException e) {
      throw new UncheckedInterruptedException(e, "Interrupted while listing databases");
    }
    databases.forEach(
        db ->
            Preconditions.checkState(
                db.type() == SnowflakeIdentifier.Type.DATABASE,
                "Expected DATABASE, got identifier '%s'",
                db));
    return databases;
  }
@SuppressWarnings("unchecked")
  @Test
  public void testListDatabasesSQLExceptionWithoutErrorCode()
      throws SQLException, InterruptedException {
    Exception injectedException = new SQLException("Fake SQL exception");
    when(mockClientPool.run(any(ClientPool.Action.class))).thenThrow(injectedException);

    assertThatExceptionOfType(UncheckedSQLException.class)
        .isThrownBy(() -> snowflakeClient.listDatabases())
        .withMessageContaining("Failed to list databases")
        .withCause(injectedException);
  }