Closed tcrayford closed 9 years ago
Can we move all of these exceptions our into a separate file?
I feel like we might find a better place to put this oneliner as well:
INVALID_REQUEST_ERROR_MAPPING = Hash[Rets.constants.map {|c| Rets.const_get(c) }.select { |klass| klass.is_a?(Class) && klass < Rets::InvalidRequest }.map {|klass| [klass.const_get('ERROR_CODE'), klass] }]
do you want me to move all our exceptions into that file? Or just these exceptions?
(was thinking like lib/rets/exceptions.rb
). It does feel kinda weird, because these will still have to be at the toplevel namespace, so that class won't define a module Rets::Exceptions
or anything, just module Rets…
, which might make it a little harder to find those errors for folk new to the codebase.
This is backward compatible because of subtyping so I think this is good to go.
this adds specific exception classes for most of the rets errors defined in the spec (http://www.reso.org/assets/RETS/Specifications/rets_1_8.pdf, Appendix C).
They subclass InvalidRequest, because that's what we used to throw in these cases, so there's complete backwards compatability.