Sha256: 91f728d134f87ff19e39dcfbfc29b96a96553f081a0d2e41274d11b0e2d9c63c

Contents?: true

Size: 456 Bytes

Versions: 23

Compression:

Stored size: 456 Bytes

Contents

require 'ostruct'

module Jimmy
  class ValidationError < StandardError

    attr_reader :schema, :data, :errors

    def initialize(schema, data, errors)
      @schema = schema
      @data   = data
      @errors = errors.map do |info|
        OpenStruct.new(
            property: info[:fragment][2..-1],
            message:  info[:message].gsub(/ in schema \S+$/, ''),
            aspect:   info[:failed_attribute]
        )
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
jimmy-0.5.5 lib/jimmy/validation_error.rb
jimmy-0.5.4 lib/jimmy/validation_error.rb
jimmy-0.5.3 lib/jimmy/validation_error.rb
jimmy-0.5.2 lib/jimmy/validation_error.rb
jimmy-0.5.1 lib/jimmy/validation_error.rb
jimmy-0.5.0 lib/jimmy/validation_error.rb
jimmy-0.4.8 lib/jimmy/validation_error.rb
jimmy-0.4.7 lib/jimmy/validation_error.rb
jimmy-0.4.6 lib/jimmy/validation_error.rb
jimmy-0.4.5 lib/jimmy/validation_error.rb
jimmy-0.4.4 lib/jimmy/validation_error.rb
jimmy-0.4.3 lib/jimmy/validation_error.rb
jimmy-0.4.2 lib/jimmy/validation_error.rb
jimmy-0.4.1 lib/jimmy/validation_error.rb
jimmy-0.4 lib/jimmy/validation_error.rb
jimmy-0.3.4 lib/jimmy/validation_error.rb
jimmy-0.3.3 lib/jimmy/validation_error.rb
jimmy-0.3.2 lib/jimmy/validation_error.rb
jimmy-0.3.1 lib/jimmy/validation_error.rb
jimmy-0.3 lib/jimmy/validation_error.rb