Module: Kwalify::ErrorHelper
Instance Method Summary collapse
- #_build_message(message_key, val, args) ⇒ Object
- #assert_error(message = "") ⇒ Object
- #schema_error(error_symbol, rule, path, val, args = nil) ⇒ Object
- #validate_error(error_symbol, rule, path, val, args = nil) ⇒ Object
Instance Method Details
#_build_message(message_key, val, args) ⇒ Object
93 94 95 96 97 98 99 |
# File 'lib/kwalify/errors.rb', line 93 def (, val, args) msg = Kwalify.msg() 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 = "") ⇒ Object
79 80 81 |
# File 'lib/kwalify/errors.rb', line 79 def assert_error(="") raise AssertionError.new() end |
#schema_error(error_symbol, rule, path, val, args = nil) ⇒ Object
88 89 90 91 |
# File 'lib/kwalify/errors.rb', line 88 def schema_error(error_symbol, rule, path, val, args=nil) msg = (error_symbol, val, args); return SchemaError.new(msg, path, val, rule, error_symbol) end |
#validate_error(error_symbol, rule, path, val, args = nil) ⇒ Object
83 84 85 86 |
# File 'lib/kwalify/errors.rb', line 83 def validate_error(error_symbol, rule, path, val, args=nil) msg = (error_symbol, val, args); return ValidationError.new(msg, path, val, rule, error_symbol) end |