Skip to content

Commit

Permalink
catch no such bucket on bucket delete
Browse files Browse the repository at this point in the history
  • Loading branch information
Foxcapades committed May 7, 2022
1 parent edb8d6f commit 3b9f4fd
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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<String> {
Expand Down

0 comments on commit 3b9f4fd

Please sign in to comment.