https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44048 Bug ID: 44048 Summary: Koha::Account->add_debit swallows unexpected errors and returns undef Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: Fines and fees Assignee: koha-bugs@lists.koha-community.org Reporter: babarjunaid1122@gmail.com QA Contact: testopia@bugs.koha-community.org Target Milestone: --- In Koha::Account->add_debit the catch block only handles Koha::Exceptions::Object::FKConstraint: a broken debit_type_code becomes UnrecognisedType, any other broken FK is rethrown. Every other error raised while the debit, its offset or its log are stored is swallowed, and add_debit returns undef as if it had run. Callers then carry on as if the charge was added: the transaction that should have been rolled back is committed without it, and nothing reports that a fine, a rental charge or a lost fee was never recorded. add_credit does this correctly: after its FK branch it rethrows ($_->rethrow). To see it: make Koha::Account::Line->store die (e.g. mock it in a test) and call add_debit: no exception, return value undef. Same code on main and 26.05. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.