On Friday, March 27, 2020 at 3:07:45 AM UTC-7, David Espada Garcia wrote:
>
> Hi. 
>
> I use Sequel with Postgresql and I am getting a postgresql exception when 
> passing to any date field a value like "02:02:0000", because of "0000" 
> year. I'd like to catch those errors in all date fields by default. Which 
> is the best option for doing so? 
>

If you are using models, you would generally validate the data before use.  
I think the auto_validations plugin may cover that use case.

If you aren't using models, you would either check all data manually before 
submitting the query, or you would rescue the Sequel::DatabaseError and 
handle it appropriately.

Thanks,
Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sequel-talk+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/60507842-e66f-4093-b3a0-5e980af88eac%40googlegroups.com.

Reply via email to