Bug 34316 - account->add_credit does not rethrow exception
Summary: account->add_credit does not rethrow exception
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Marcel de Rooy
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 33608
  Show dependency treegraph
 
Reported: 2023-07-20 07:28 UTC by Marcel de Rooy
Modified: 2023-12-28 20:47 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.11.00,23.05.03,22.11.09,22.05.16


Attachments
Bug 34316: Add_credit should rethrow an exception correctly (955 bytes, patch)
2023-07-20 08:00 UTC, Marcel de Rooy
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Marcel de Rooy 2023-07-20 07:28:52 UTC
Found while debugging 33608 on a new failure in Items.t.
It was a FK constraint on credit_id which was very misleading.
Cause is an exception that was not rethrown in Accounts coming from a wrong statistic type and revealed now by new code in UpdateStats/Statistic.pm.
Comment 1 Marcel de Rooy 2023-07-20 08:00:20 UTC
Created attachment 153697 [details] [review]
Bug 34316: Add_credit should rethrow an exception correctly

Found while running Items.t on top of 33608.
Another exception was thrown but not rethrown.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 2 Marcel de Rooy 2023-07-20 08:16:46 UTC
(In reply to Marcel de Rooy from comment #0)
> Found while debugging 33608 on a new failure in Items.t.
> It was a FK constraint on credit_id which was very misleading.
> Cause is an exception that was not rethrown in Accounts coming from a wrong
> statistic type and revealed now by new code in UpdateStats/Statistic.pm.

Actually, there is still another thing ;)
Related to new code that looks at value instead of amount.
So 33608 needs a correction too.
Rethrowing the exception should go here on its own.
Comment 3 Marcel de Rooy 2023-07-20 08:17:18 UTC
Moving to PQA. Trivial and needed.
Comment 4 Martin Renvoize 2023-07-20 09:23:42 UTC
Looks good to me
Comment 5 Tomás Cohen Arazi 2023-07-20 14:01:04 UTC
Pushed to master for 23.11.

Nice work everyone, thanks!
Comment 6 Fridolin Somers 2023-08-04 01:51:17 UTC
Pushed to 23.05.x for 23.05.03
Comment 7 Pedro Amorim 2023-08-18 10:53:48 UTC
Nice work everyone!

Pushed to 22.11.x for next release
Comment 8 Lucas Gass 2023-09-13 21:02:27 UTC
Backported to 22.05.x for upcoming 22.05.16