class Cuprum::Errors::OperationNotCalled

Error class to be used when trying to access the result of an uncalled Operation.

Constants

MESSAGE_FORMAT

Format for generating error message.

TYPE

Short string used to identify the type of error.

Attributes

operation[R]

@return [Cuprum::Operation] The uncalled operation.

Public Class Methods

new(operation:) click to toggle source

@param operation [Cuprum::Operation] The uncalled operation.

Calls superclass method Cuprum::Error::new
# File lib/cuprum/errors/operation_not_called.rb, line 17
def initialize(operation:)
  @operation = operation

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

  super(message: message, operation: operation)
end

Private Instance Methods

as_json_data() click to toggle source
# File lib/cuprum/errors/operation_not_called.rb, line 31
def as_json_data
  operation ? { 'class_name' => operation.class.name } : {}
end