Method: AwsResourceMixin#catch_aws_errors
- Defined in:
- lib/resource_support/aws/aws_resource_mixin.rb
#catch_aws_errors ⇒ Object
Intercept AWS exceptions
58 59 60 61 62 63 64 65 66 67 |
# File 'lib/resource_support/aws/aws_resource_mixin.rb', line 58 def catch_aws_errors yield rescue Aws::Errors::MissingCredentialsError # The AWS error here is unhelpful: # "unable to sign request without credentials set" Inspec::Log.error "It appears that you have not set your AWS credentials. You may set them using environment variables, or using the 'aws://region/aws_credentials_profile' target. See https://www.inspec.io/docs/reference/platforms for details." fail_resource("No AWS credentials available") rescue Aws::Errors::ServiceError => e fail_resource e. end |