Exception: Otoroshi::AssertionError

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

Overview

Manages errors raised when value does not pass the assertion

Instance Method Summary collapse

Constructor Details

#initialize(property, array: false) ⇒ AssertionError

Initialize an error

Parameters:

  • property (Symbol)

    name of the property

  • array (true, false) (defaults to: false)

    define if it is an array



63
64
65
66
67
68
69
70
71
# File 'lib/otoroshi/exceptions.rb', line 63

def initialize(property, array: false)
  msg =
    if array
      ":#{property} contains elements that do not respect the assertion"
    else
      ":#{property} does not respect the assertion"
    end
  super(msg)
end