- Defined in:
The throw_failures plugin throws HookFailed and ValidationFailed exceptions instead of raising them. If there is no matching catch block, the UncaughtThrowError will be rescued and the HookFailed or ValidationFailed exception will be raised normally.
If you are setting up the catch blocks to handle these failures, in the failure case this plugin is about 10-15% faster on CRuby and 10x faster on JRuby. If you are not setting up the catch blocks, in the failure case this plugin is about 30% slower on CRuby and 2x slower on JRuby. So this plugin should only be used if you are setting up catch blocks manually.
This plugin will setup catch blocks automatically for internally rescued HookFailed exceptions when the model is configured to not raise exceptions on failure (by default, the exceptions are internally rescued in that case.
To set up the catch blocks, use the class of the exception:
ret = catch(::) do
# handle failure
# handle success
# Make all model subclass instances throw HookFailed and ValidationFailed exceptions
# (called before loading subclasses)
# Make the Album class throw HookFailed and ValidationFailed exceptions
Defined Under Namespace