From 3b9f4fd92c5353e05b3821e5a16f0fbc51e4f573 Mon Sep 17 00:00:00 2001 From: Elizabeth Date: Sat, 7 May 2022 12:47:23 -0400 Subject: [PATCH] catch no such bucket on bucket delete --- .../s3/s34k/minio/operations/RecursiveBucketDeleter.kt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/org/veupathdb/lib/s3/s34k/minio/operations/RecursiveBucketDeleter.kt b/src/main/kotlin/org/veupathdb/lib/s3/s34k/minio/operations/RecursiveBucketDeleter.kt index 28c78a9..15ebe1a 100644 --- a/src/main/kotlin/org/veupathdb/lib/s3/s34k/minio/operations/RecursiveBucketDeleter.kt +++ b/src/main/kotlin/org/veupathdb/lib/s3/s34k/minio/operations/RecursiveBucketDeleter.kt @@ -5,6 +5,7 @@ import io.minio.messages.Item import io.minio.messages.DeleteObject import org.slf4j.LoggerFactory import org.veupathdb.lib.s3.s34k.errors.BucketDeleteError +import org.veupathdb.lib.s3.s34k.errors.BucketNotFoundError import org.veupathdb.lib.s3.s34k.errors.MultiObjectDeleteError import org.veupathdb.lib.s3.s34k.errors.ObjectDeleteError import org.veupathdb.lib.s3.s34k.fields.BucketName @@ -22,8 +23,12 @@ internal class RecursiveBucketDeleter( private val log = LoggerFactory.getLogger(this::class.java) fun execute() { - deleteObjects(listObjects()) - deleteBucket() + try { + deleteObjects(listObjects()) + deleteBucket() + } catch (e: BucketNotFoundError) { + // do nothing + } } private fun listObjects(): Stream {