-1

My colleagues from support often tell me that customers are not able to fill in this form because of a bug.

The form is very large, sometimes, it is a legitimate bug, sometimes it is just a validation issue of the form (not technically a bug but let's say a usability bug). Sometimes the validation itself is just a bug (like the format of a field has changed and the form will never be valid).

I use sentry.io to track errors, but is there a way to track form validation failures ?

I suppose I could use another tool that sentry but I am also interested to know I could make a special callback on all form validations to either send an issue to sentry, email, etc

thx

rapdev
  • 81
  • 1
  • 8

1 Answers1

1

All you need to do is rescue from ActiveRecord::RecordInvalid error and do whatever you want to do with validation failures

begin
  complex_form.save!
rescue ActiveRecord::RecordInvalid => invalid
  ErrorMailer.delay.send(invalid.record.errors)
end
Tony Vincent
  • 13,354
  • 7
  • 49
  • 68