Skip to content

Conversation

dgm
Copy link

@dgm dgm commented Aug 8, 2016

As we have been discussing in a patch comment thread, the least surprise would be for the validations to raise errors as the occur, not swallow them. I think this will give us that without breaking existing systems.

…so we can fix early. Setting config option to minimize damage to existing systems
@adzap
Copy link
Owner

adzap commented Aug 8, 2016

Thanks! Looks good, though I had in mind to merge the ignore/raise/error into a single config setting. Then override the old setting accordingly.

Something like this

 e if ValidatesTimeliness.validation_errors == :raise
 if ValidatesTimeliness.validation_errors == :message

or heaven forbid a case statement

case ValidatesTimeliness.validation_errors
when :raise 
  raise e
when :message
  add_error(record, message)
when :log
   Rails.logger.warn('validation error')
else # :ignore
end

thoughts?

@dgm
Copy link
Author

dgm commented Aug 9, 2016

I got no complaints :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants