Class: Stackster::AWS::CloudFormation::Error

Inherits:
Object
  • Object
show all
Defined in:
lib/stackster/aws/cloud_formation/error.rb

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Error

Returns a new instance of Error.



8
9
10
11
12
# File 'lib/stackster/aws/cloud_formation/error.rb', line 8

def initialize(args)
  @exception = args[:exception]
  @config    = args[:config]
  @logger    = @config.logger
end

Instance Method Details

#processObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/stackster/aws/cloud_formation/error.rb', line 14

def process
  message = XmlSimple.xml_in @exception.response.body
  message['Error'].first['Message'].each do |msg|
    case msg
    when 'No updates are to be performed.'
      @logger.info msg
    when /^Stack:(.*) does not exist$/
      @logger.error msg
      raise Stackster::Exceptions::UnknownStack.new msg
    else
      @logger.error msg
      raise Stackster::Exceptions::CloudFormationError.new msg
    end
  end
end