Reputation: 1283
I am trying to rescue an aws s3 exception.
class FileManager
def fetchFile
begin
s3.get_object(bucket:'myBucket', key: file_name)
rescue Aws::S3::Errors => e
debugger
end
end
end
Then when I call the method from console
FileManager.fetch_file('Non existing file')
I am not getting the debugger instead there is an error message in the console
Aws::S3::Errors::NoSuchKey: The specified key does not exist.
Upvotes: 0
Views: 1544
Reputation: 14282
You can rescue all S3 errors using ServiceError
begin
# ...
rescue Aws::S3::Errors::ServiceError => e
# ...
end
Upvotes: 2
Reputation: 170
I believe this has what your looking for (assuming you are using this gem):
https://github.com/marcel/aws-s3#when-things-go-wrong
Upvotes: 1