On my user model I have a name and an email field and I want both to be unique.
I have read this https://github.com/hanami/validations#uniqueness-validation and while it makes perfect sense it still doesn't help me implement this properly. I have unique index constraints on both fields but I can't just show a stack trace, I need to render a nice message for the user.
I tried rescuing
Hanami::Model::UniqueConstraintViolationError and then adding the errors from there (similar to what was suggested in this old thread) but that error object has an empty interface so the only way I see of finding out which field had the unique constraint violated is by parsing the message, which seems like a strange thing to do for such a common thing.
Am I missing something? I would be very grateful if someone could share how they are handling uniqueness validations in their projects.