Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,14 @@ public String getAuthToken() {

@Override
public boolean checkFolderPromoted(S3PathResolver s3PathResolver, String folderName) {
DremioDirectoryItemsResponse directoryItems = getDirectoryItems(s3PathResolver, folderName);
DremioDirectoryItemsResponse directoryItems;
try {
directoryItems = getDirectoryItems(s3PathResolver, folderName);
} catch (Exception e) {
LOG.warn("Could not get directory items for folder {}", folderName, e);
return false;
}

if (directoryItems!=null) {
Integer itemPosition;
if (S3_IMPORT_FILE_PATH.equals(s3PathResolver.getPath())) {
Expand Down Expand Up @@ -149,7 +156,14 @@ public DremioDirectoryItemsResponse getDirectoryItems(S3PathResolver s3PathResol
@Override
public String getFolderId(S3PathResolver s3PathResolver, String folderName) {
String folderId = null;
DremioDirectoryItemsResponse directoryItems = getDirectoryItems(s3PathResolver, folderName);
DremioDirectoryItemsResponse directoryItems;
try {
directoryItems = getDirectoryItems(s3PathResolver, folderName);
} catch (Exception e) {
LOG.warn("Could not retrieve directory items for datasetId" + s3PathResolver.getDatasetId(), e);
return null;
}

if (directoryItems!=null) {
Integer itemPosition;
if (S3_IMPORT_FILE_PATH.equals(s3PathResolver.getPath())) {
Expand Down Expand Up @@ -211,6 +225,11 @@ public void promoteFolderOrFile(S3PathResolver s3PathResolver, String folderName
throw new RuntimeException(e);
}
}

if (folderId == null) {
throw new DremioApiException("Could not retrieve folder id for datasetId "
+ s3PathResolver.getDatasetId() + " and folder " + folderName);
}

try {
dremioApiController.promote(token, folderId, requestBody);
Expand Down