Sha256: 0155623c89a880d1a390573f06ea9a5e2caedffd767ead9d6e01964db82da766

Contents?: true

Size: 473 Bytes

Versions: 13

Compression:

Stored size: 473 Bytes

Contents

class Tram::Policy
  # An exception to be risen by [Tram::Policy#validate!]
  class ValidationError < RuntimeError
    # Policy object whose validation has caused the exception
    #
    # @return [Tram::Policy]
    #
    attr_reader :policy

    private

    def initialize(policy, filter)
      @policy  = policy
      messages = policy.errors.reject(&filter).map(&:full_message)
      super (["Validation failed with errors:"] + messages).join("\n- ")
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
tram-policy-0.3.1 lib/tram/policy/validation_error.rb
tram-policy-0.3.0 lib/tram/policy/validation_error.rb
tram-policy-0.2.5 lib/tram/policy/validation_error.rb
tram-policy-0.2.4 lib/tram/policy/validation_error.rb
tram-policy-0.2.3 lib/tram/policy/validation_error.rb
tram-policy-0.2.2 lib/tram/policy/validation_error.rb
tram-policy-0.2.1 lib/tram/policy/validation_error.rb
tram-policy-0.2.0 lib/tram/policy/validation_error.rb
tram-policy-0.1.1 lib/tram/policy/validation_error.rb
tram-policy-0.1.0 lib/tram/policy/validation_error.rb
tram-policy-0.0.3 lib/tram/policy/validation_error.rb
tram-policy-0.0.2 lib/tram/policy/validation_error.rb
tram-policy-0.0.1 lib/tram/policy/validation_error.rb