lib/elasticrawl/config.rb in elasticrawl-1.1.0 vs lib/elasticrawl/config.rb in elasticrawl-1.1.1
- old
+ new
@@ -98,12 +98,12 @@
s3 = AWS::S3.new
s3.buckets[bucket_name].exists?
rescue AWS::S3::Errors::SignatureDoesNotMatch => e
raise AWSCredentialsInvalidError, 'AWS access credentials are invalid'
- rescue StandardError => e
- raise S3AccessError, e.message
+ rescue AWS::Errors::Base => s3e
+ raise S3AccessError.new(s3e.http_response), e.message
end
end
# Creates the S3 bucket and config directory. Deploys the config templates
# and creates the sqlite database.
@@ -156,23 +156,23 @@
def create_bucket(bucket_name)
begin
s3 = AWS::S3.new
s3.buckets.create(bucket_name)
- rescue StandardError => e
- raise S3AccessError, e.message
+ rescue AWS::Errors::Base => s3e
+ raise S3AccessError.new(s3e.http_response), e.message
end
end
# Deletes a bucket and its contents using the S3 API.
def delete_bucket(bucket_name)
begin
s3 = AWS::S3.new
bucket = s3.buckets[bucket_name]
bucket.delete!
- rescue StandardError => e
- raise S3AccessError, e.message
+ rescue AWS::Errors::Base => s3e
+ raise S3AccessError.new(s3e.http_response), e.message
end
end
# Creates config directory and copies config templates into it.
# Saves S3 bucket name to jobs.yml and AWS credentials to aws.yml.