Exception: Operandi::RuntimeError

Inherits:
Error
  • Object
show all
Defined in:
lib/operandi/exceptions.rb

Overview

Raised for failures that occur while a service instance is running.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message = nil, service:) ⇒ RuntimeError

Returns a new instance of RuntimeError.

Parameters:

  • message (String, nil) (defaults to: nil)

    the error message

  • service (Base)

    the service instance that raised the error

Raises:

  • (ArgumentError)


14
15
16
17
18
19
20
21
22
23
# File 'lib/operandi/exceptions.rb', line 14

def initialize(message = nil, service:)
  raise ArgumentError, "service is required" unless service

  unless defined?(Operandi::Base) && service.is_a?(Operandi::Base)
    raise ArgumentError, "service must be an Operandi::Base instance"
  end

  @service = service
  super(message)
end

Instance Attribute Details

#serviceBase (readonly)

Returns the service instance that raised the error.

Returns:

  • (Base)

    the service instance that raised the error



10
11
12
# File 'lib/operandi/exceptions.rb', line 10

def service
  @service
end