revbank/lib/RevBank
Juerd Waalboer 52749df5f3 Ignore all hook exceptions except in hook_checkout_prepare
A space had a custom plugin that died during hook_checkout, which caused
the CHECKOUT lines to be logged without the corresponding BALANCE, and
indeed no account balances were updated. While the plugin had a bug, it
should not cause a half transaction in RevBank.

After some hesitation, I went with ON ERROR RESUME NEXT because if a
hook throws an exception, that should not interfere with other plugins
(the hook can return ABORT if this it was intentional), including the
calling plugin. An error message is printed (but not logged... TODO: add
hook_plugin_fail to plugins/log) but the show must go on.

During hook_checkout_prepare, however, nothing is set in stone yet, so
this could be used for something that might die, and this instance of
call_hooks() is now the one place where a failing hook should result in
the transaction getting aborted. For this, call_hooks() now returns a
success status boolean. Maybe it would make sense in more places, but I
didn't identify any such calls yet.

RevBank::Cart->checkout used to return a success status boolean, but it
could just as well just die (indirectly, to abort the transaction) since
it can't be called a second time within the same transaction anyway
(because ->set_user must be called exactly once), so continuing with the
same transaction can't result in anything useful anyway.

In some places, error messages were slightly improved to contain a bit
more information.
2023-11-24 05:15:22 +01:00
..
Cart Use formerly experimental Perl features with "use experimental" 2023-09-10 02:13:33 +02:00
Amount.pm Use formerly experimental Perl features with "use experimental" 2023-09-10 02:13:33 +02:00
Amount.pod typo 2022-06-12 02:34:34 +02:00
Cart.pm Ignore all hook exceptions except in hook_checkout_prepare 2023-11-24 05:15:22 +01:00
Eval.pm cwd is no longer in @INC in new perl versions 2017-02-18 22:31:19 +01:00
FileIO.pm Ignore all hook exceptions except in hook_checkout_prepare 2023-11-24 05:15:22 +01:00
FileIO.pod Implement global advisory lock 2022-08-29 17:50:12 +02:00
Global.pm Formal mechanism for retrying input 2023-09-18 01:31:13 +02:00
Global.pod Split documentation for RevBank::Global 2023-05-23 12:56:34 +02:00
Messages.pm Formal mechanism for retrying input 2023-09-18 01:31:13 +02:00
Plugin.pm Add support for user-accessible accounts that are excluded from grandtotal 2023-11-02 05:33:33 +01:00
Plugins.pm Ignore all hook exceptions except in hook_checkout_prepare 2023-11-24 05:15:22 +01:00
Plugins.pod Ignore all hook exceptions except in hook_checkout_prepare 2023-11-24 05:15:22 +01:00
TextEditor.pm Use formerly experimental Perl features with "use experimental" 2023-09-10 02:13:33 +02:00
TextEditor.pod bump to v3.5; add built-in editor 2022-08-30 20:45:01 +02:00
Users.pm Add assertions 2023-11-05 21:19:17 +01:00
Users.pod Document RevBank::Users (accounts) 2023-11-05 21:19:39 +01:00