Exception: ValidationError
- Inherits:
-
JSONError
show all
- Defined in:
- lib/ldapmodel/errors.rb
Instance Attribute Summary
Attributes inherited from JSONError
#meta
Instance Method Summary
(collapse)
Methods inherited from JSONError
#headers, #initialize, #to_json
Constructor Details
This class inherits a constructor from JSONError
Instance Method Details
- (Object) as_json
70
71
72
73
74
75
76
|
# File 'lib/ldapmodel/errors.rb', line 70
def as_json
parent = super
parent[:error][:meta] = {
:invalid_attributes => @meta[:invalid_attributes]
}
parent
end
|
- (Object) http_code
50
51
52
|
# File 'lib/ldapmodel/errors.rb', line 50
def http_code
400
end
|
- (Object) to_s
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
# File 'lib/ldapmodel/errors.rb', line 54
def to_s
dn = ""
if @meta[:dn]
dn = "(#{ @meta[:dn] })"
end
msg = @message
msg += "\n Invalid attributes for #{ @meta[:className] } #{ dn }:\n"
Array(@meta[:invalid_attributes]).each do |attr, errors|
errors.each do |error|
msg += " * #{ attr }: #{ error[:message] }\n"
end
end
msg + "\n"
end
|