Exception: Bhm::Errors::InvalidHash

Inherits:
KeyError
  • Object
show all
Includes:
Chainable
Defined in:
lib/bhm/errors.rb

Overview

Generic error – the hash could not be fully validated

Instance Method Summary collapse

Methods included from Chainable

#error_chain, included

Constructor Details

#initialize(message = nil, receiver:, key:) ⇒ InvalidHash

Returns a new instance of InvalidHash.



45
46
47
48
# File 'lib/bhm/errors.rb', line 45

def initialize(message = nil, receiver:, key:)
  message ||= "the hash could not be fully validated"
  super(message, receiver: receiver, key: key)
end

Instance Method Details

#refObject

From the invalid hash, get a period-joined string of keys leading to the invalid key or value



51
52
53
# File 'lib/bhm/errors.rb', line 51

def ref
  error_chain.map(&:key).join(".")
end