class ReeErrors::Error
def initialize(msg = nil)
def initialize(msg = nil) if !msg && !locale && !default_msg raise ArgumentError, "message, locale or default message should be specified" end message = if msg msg elsif default_msg default_msg else path = (locale || code).to_s has_path = path.include?(".") if has_path pre_path = [caller_module, caller_class].compact.map { underscore(_1)}.join(".") if check_locale_exists(path) t(path, default_by_locale: :en) else t("#{pre_path}.#{path}", default_by_locale: :en) end else if caller_module mod = underscore(caller_module) klass = underscore(caller_class) if check_locale_exists(loc = "#{mod}.errors.#{klass}.#{path}") t(loc, default_by_locale: :en) else check_locale_exists(loc = "#{mod}.errors.#{path}") t(loc, default_by_locale: :en) end else end end end super(message) end