Skip to content

Commit

Permalink
Remove usage of TrinoException from GcsStorageFactory
Browse files Browse the repository at this point in the history
  • Loading branch information
electrum committed Aug 9, 2024
1 parent 7ab3569 commit ce90afa
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,20 @@
import com.google.inject.Inject;
import io.trino.hdfs.HdfsContext;
import io.trino.hdfs.HdfsEnvironment;
import io.trino.spi.TrinoException;
import org.apache.hadoop.fs.Path;

import java.io.ByteArrayInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.UncheckedIOException;
import java.time.Duration;
import java.util.Optional;

import static com.google.cloud.hadoop.fs.gcs.TrinoGoogleHadoopFileSystemConfiguration.getGcsOptionsBuilder;
import static com.google.cloud.hadoop.repackaged.gcs.com.google.cloud.hadoop.util.CredentialFactory.DEFAULT_SCOPES;
import static com.google.common.base.Strings.nullToEmpty;
import static io.trino.hdfs.gcs.GcsConfigurationProvider.GCS_OAUTH_KEY;
import static io.trino.spi.StandardErrorCode.GENERIC_INTERNAL_ERROR;
import static java.nio.charset.StandardCharsets.UTF_8;

public class GcsStorageFactory
Expand Down Expand Up @@ -97,8 +96,8 @@ public Storage create(HdfsEnvironment environment, HdfsContext context, Path pat
.setApplicationName(APPLICATION_NAME)
.build();
}
catch (Exception e) {
throw new TrinoException(GENERIC_INTERNAL_ERROR, e);
catch (IOException e) {
throw new UncheckedIOException(e);
}
}
}

0 comments on commit ce90afa

Please sign in to comment.