Module | Kwalify::ErrorHelper
In: | kwalify/errors.rb

### Methods

_build_message assert_error schema_error validate_error

### Public Instance methods

_build_message(message_key, val, args)

[Source]

    # File kwalify/errors.rb, line 114
        def _build_message(message_key, val, args)
          msg = Kwalify.msg(message_key)
          assert_error("message_key=#{message_key.inspect}") unless msg
          msg = msg % args if args
          msg = "'#{val.to_s.gsub(/\n/, '\n')}': #{msg}" if !val.nil? && Types.scalar?(val)
          return msg;
        end

assert_error(message="")

module_function

[Source]

    # File kwalify/errors.rb, line 97
        def assert_error(message="")
          raise AssertionError.new(message)
        end

schema_error(error_symbol, rule, path, val, args=nil)

[Source]

    # File kwalify/errors.rb, line 108
        def schema_error(error_symbol, rule, path, val, args=nil)
          msg = _build_message(error_symbol, val, args);
          path = '/'+path.join('/') if path.is_a?(Array)
          return SchemaError.new(msg, path, val, rule, error_symbol)
        end

validate_error(error_symbol, rule, path, val, args=nil)

[Source]

    # File kwalify/errors.rb, line 101
        def validate_error(error_symbol, rule, path, val, args=nil)
          msg = _build_message(error_symbol, val, args);
          path = '/'+path.join('/') if path.is_a?(Array)
          return ValidationError.new(msg, path, val, rule, error_symbol)
        end

[Validate]