Module: ServiceActor::ArgumentsValidator

Defined in:
lib/service_actor/arguments_validator.rb

Class Method Summary collapse

Class Method Details

.validate_error_class(value) ⇒ Object

Raises:



14
15
16
17
18
# File 'lib/service_actor/arguments_validator.rb', line 14

def validate_error_class(value)
  return if value.is_a?(Class) && value <= Exception

  raise ArgumentError, "Expected #{value} to be a subclass of Exception"
end

.validate_origin_name(name, origin:) ⇒ Object

Raises:



6
7
8
9
10
11
12
# File 'lib/service_actor/arguments_validator.rb', line 6

def validate_origin_name(name, origin:)
  return if name.to_sym == :error
  return unless ServiceActor::Result.instance_methods.include?(name.to_sym)

  raise ArgumentError,
        "#{origin} `#{name}` overrides `ServiceActor::Result` instance method"
end