Exception: Kharon::Errors::Validation

Inherits:
Exception
  • Object
show all
Defined in:
lib/kharon/errors/validation.rb

Overview

Standard exception raised in case the exceptions are used, and there is an error in the validation.

Author:

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Validation) initialize(error_hash)

Constructor of the class.

Parameters:

  • error_hash (Hash)

    the description of the encountered error as a Hash.



16
17
18
# File 'lib/kharon/errors/validation.rb', line 16

def initialize(error_hash)
  @error_hash = error_hash
end

Instance Attribute Details

- (Hash) error_hash

Returns the description of the encountered error as a Hash.

Returns:

  • (Hash)

    the description of the encountered error as a Hash.



# File 'lib/kharon/errors/validation.rb', line 10

Instance Method Details

- (String) message

Generates a JSON version of the encountered error description hash.

Returns:

  • (String)

    the JSON representation of an error.



22
23
24
# File 'lib/kharon/errors/validation.rb', line 22

def message
  JSON.generate(error_hash)
end