On Thu, Jan 14, 2021 at 1:06 AM '[email protected]' via sequel-talk <
[email protected]> wrote:

> Is it possible to extend Sequel::ConstraintViolation to include name of DB
> constraint that rises this exception?


Not generally.  However, if you are using the postgres adapter with ruby-pg
0.16.0+ and PostgreSQL 9.3+, you can do:

rescue Sequel::ConstraintViolation => e
  constraint = DB.error_info(e)[:constraint]
 end

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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/CADGZSSfLMqKpMadcG75fhLcn9-HkAsFgR6BZ8t8J7e6OpkM_7Q%40mail.gmail.com.

Reply via email to