class Kharon::Errors::Validation

Standard exception raised in case the exceptions are used, and there is an error in the validation. @author Vincent Courtois <courtois.vincent@outlook.com>

Attributes

error_hash[RW]

@!attribute [rw] error_hash @return [Hash] the description of the encountered error as a Hash.

Public Class Methods

new(error_hash) click to toggle source

Constructor of the class. @param [Hash] error_hash the description of the encountered error as a Hash.

# File lib/kharon/errors/validation.rb, line 16
def initialize(error_hash)
  @error_hash = error_hash
end

Public Instance Methods

message() click to toggle source

Generates a JSON version of the encountered error description hash. @return [String] the JSON representation of an error.

# File lib/kharon/errors/validation.rb, line 22
def message
  JSON.generate(error_hash)
end