I’ve been struggling with this for way to long –
def aws_file_exists? filename
begin
@s3_interface.get('bucket', filename)
return true
catch Aws::AwsError, Aws::AwsError2, NoSuchKey, RuntimeError, AmazonError, AWSError
return false
end
end
Only, it doesn’t catch the !(@^%@&$*%# error, which reports as:
Aws::AwsError: NoSuchKey: The specified key does not exist.
What am I doing wrong / what is the error type that I need to be catching?
Does this help?
More importantly, it should be
begin ... rescue ... end. You’re probably confusing it withtry ... catch.