Add exception to EppErrors concerning settings

This commit is contained in:
Martin Lensment 2014-08-22 12:13:41 +03:00
parent 87cc7799be
commit b42357b26d
3 changed files with 16 additions and 5 deletions

View file

@ -28,7 +28,17 @@ module EppErrors
else
next unless code = find_epp_code(err)
err = {code: code, msg: err}
err[:value] = {val: send(key), obj: self.class::EPP_ATTR_MAP[key]} unless self.class.reflect_on_association(key)
# If we have setting relation, then still add the value to the error message
# If this sort of exception happens again, some other logic has to be implemented
if self.class.reflect_on_association(key) && key == :setting
err[:value] = {val: send(key).value, obj: self.class::EPP_ATTR_MAP[key]}
#if the key represents other relations, skip value
elsif !self.class.reflect_on_association(key)
err[:value] = {val: send(key), obj: self.class::EPP_ATTR_MAP[key]}
end
epp_errors << err
end
end