Sha256: b11a1482a0d9189539e6eb402ac984199607ddc60c1f7a9f06046923e6bbe581

Contents?: true

Size: 617 Bytes

Versions: 3

Compression:

Stored size: 617 Bytes

Contents

require "singleton"

module Kharon
  module Handlers

    # Errors handler that raises exception as soon as a problem is encountered during validation.
    # @author Vincent Courtois <courtois.vincent@outlook.com>
    class Exceptions
      include Singleton

      # Method used to report an error by raising the correct type of exception.
      # @param [Hash] error_hash a Hash describing the error.
      # @raise [Kharon::Errors::Validation] the exception raised when an error is encountered.
      def report_error(error_hash)
        raise Kharon::Errors::Validation.new(error_hash)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
kharon-1.1.1 lib/kharon/handlers/exceptions.rb
kharon-1.1.0 lib/kharon/handlers/exceptions.rb
kharon-1.0.0 lib/kharon/handlers/exceptions.rb