Skip to content

Commit 4584b3d

Browse files
committed
Catch all exceptions
1 parent 2f6a67d commit 4584b3d

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

modules/repository-s3/src/main/java/org/elasticsearch/repositories/s3/S3BlobContainer.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -377,12 +377,11 @@ public void copyBlob(
377377
SocketAccess.doPrivilegedVoid(() -> { clientReference.client().copyObject(copyRequest); });
378378
}
379379
}
380-
} catch (final AmazonClientException e) {
381-
if (e instanceof AmazonS3Exception amazonS3Exception) {
382-
if (amazonS3Exception.getStatusCode() == RestStatus.NOT_FOUND.getStatus()) {
383-
final var sourceKey = s3SourceBlobContainer.buildKey(sourceBlobName);
384-
throw new NoSuchFileException("Copy source [" + sourceKey + "] not found: " + amazonS3Exception.getMessage());
385-
}
380+
} catch (final Exception e) {
381+
if (e instanceof AmazonServiceException ase && ase.getStatusCode() == RestStatus.NOT_FOUND.getStatus()) {
382+
throw new NoSuchFileException(
383+
"Copy source [" + s3SourceBlobContainer.buildKey(sourceBlobName) + "] not found: " + ase.getMessage()
384+
);
386385
}
387386
throw new IOException("Unable to copy object [" + blobName + "] from [" + sourceBlobContainer + "][" + sourceBlobName + "]", e);
388387
}
@@ -619,7 +618,7 @@ private void executeMultipart(
619618
SocketAccess.doPrivilegedVoid(() -> clientReference.client().completeMultipartUpload(complRequest));
620619
}
621620
success = true;
622-
} catch (final AmazonClientException e) {
621+
} catch (final Exception e) {
623622
if (e instanceof AmazonServiceException ase && ase.getStatusCode() == RestStatus.NOT_FOUND.getStatus()) {
624623
throw new NoSuchFileException(blobName, null, e.getMessage());
625624
}

0 commit comments

Comments
 (0)