Class: Cuprum::Errors::OperationNotCalled

Inherits:
Cuprum::Error show all
Defined in:
lib/cuprum/errors/operation_not_called.rb

Overview

Error returned when trying to access the result of an uncalled Operation.

Constant Summary collapse

TYPE =

Short string used to identify the type of error.

'cuprum.errors.operation_not_called'

Instance Attribute Summary collapse

Attributes inherited from Cuprum::Error

#message, #type

Instance Method Summary collapse

Methods inherited from Cuprum::Error

#==, #as_json

Constructor Details

#initialize(operation:) ⇒ OperationNotCalled

Returns a new instance of OperationNotCalled.

Parameters:



16
17
18
19
20
21
22
23
# File 'lib/cuprum/errors/operation_not_called.rb', line 16

def initialize(operation:)
  @operation = operation

  class_name = operation&.class&.name || 'operation'
  message    = MESSAGE_FORMAT % class_name

  super(message: message, operation: operation)
end

Instance Attribute Details

#operationCuprum::Operation (readonly)

Returns The uncalled operation.

Returns:



26
27
28
# File 'lib/cuprum/errors/operation_not_called.rb', line 26

def operation
  @operation
end