Class: Kitchen::Terraform::Raise::ClientError

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

Overview

ClientError is the class of objects which handle errors that are caused by incorrect use of an API.

Instance Method Summary collapse

Constructor Details

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

#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/client_error.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::ClientError)


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

def call(message:)
  logger.error message

  raise ::Kitchen::ClientError, message
end