How to turn :before_add exceptions into validation errors

As per

Possible callbacks are: before_add, after_add, before_remove and
Should any of the before_add callbacks throw an exception, the
object does not get added to the collection. Same with the
before_remove callbacks; if an exception is thrown the object doesn‘t
get removed.

However, when the add fails due to a before_add violation, the
exception thrown just blows up the whole stack. It doesn’t get caught
and turned into a Validation error on the object.

Is there a standard pattern for handling this?



I’m having the same problem with a :before_add association callback.
However, I’m actually adding the error directly to my model THEN
the exception. But like you found, somewhere in the stack the model’s
errors get cleared or something and I don’t see the error that I
added to my model.

Could really use some help with this…thanks!