Class: Kitchen::Terraform::Raise::ActionFailed

Inherits:
Object
  • Object
show all
Defined in:
lib/kitchen/terraform/raise/action_failed.rb

Overview

ActionFailed is the class of objects which handle errors resulting in failed actions.

Instance Method Summary collapse

Constructor Details

#initialize(logger:) ⇒ Kitchen::Terraform::ActionFailed

#initialize prepares a new instance of the class.

Parameters:

  • logger (Kitchen::Logger)

    a logger to log messages.



39
40
41
# File 'lib/kitchen/terraform/raise/action_failed.rb', line 39

def initialize(logger:)
  self.logger = logger
end

Instance Method Details

#call(message:) ⇒ void

This method returns an undefined value.

#call logs an error message and raises an error with the message.

Parameters:

  • message (String)

    the error message.

Raises:

  • (Kitchen::ActionFailed)


29
30
31
32
33
# File 'lib/kitchen/terraform/raise/action_failed.rb', line 29

def call(message:)
  logger.error message

  raise ::Kitchen::ActionFailed, message
end