Module: Stackup::ErrorHandling

Included in:
ChangeSet, Stack
Defined in:
lib/stackup/error_handling.rb

Overview

Handle Aws::CloudFormation::Errors::ValidationError.

Instance Method Summary collapse

Instance Method Details

#handling_cf_errorsObject

Invoke an Aws::CloudFormation operation.

If an exception is raised, convert it to a Stackup exception, if appropriate.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/stackup/error_handling.rb', line 14

def handling_cf_errors
  yield
rescue Aws::CloudFormation::Errors::ChangeSetNotFound => _e
  raise NoSuchChangeSet, "no such change-set"
rescue Aws::CloudFormation::Errors::ValidationError => e
  case e.message
  when /Stack .* does not exist/
    raise NoSuchStack, "no such stack"
  when "No updates are to be performed."
    raise NoUpdateRequired, "no updates are required"
  when / can ?not be /
    raise InvalidStateError, e.message
  else
    raise ValidationError, e.message
  end
end