Method: S3::Bucket#exists?

Defined in:
lib/s3/bucket.rb

#exists?Boolean

Similar to retrieve, but catches S3::Error::NoSuchBucket exceptions and returns false instead. Also catch S3::Error::ForbiddenBucket and return true

Returns:

  • (Boolean)


54
55
56
57
58
59
60
61
# File 'lib/s3/bucket.rb', line 54

def exists?
  retrieve
  true
rescue Error::ForbiddenBucket
  true
rescue Error::NoSuchBucket
  false
end