association callback clarification

The documentation of habtm states that:

“If a before_add callback throws an exception, the object does not get added to the collection.”

I am not sure if this means to raise or throw. If I raise an exception, the exception just bubbles up all the way to the calling code. If I throw instead (not sure what symbol to use for the throw if I expect the framework to catch it), I get an uncaught throw error. If I catch/rescue it myself, I don’t quite understand what to do there.

In any case, I do not know how to avoid the object being added to the collection. I am using rails 4.2.3

Could someone please help?