]> git.koha-community.org Git - koha.git/commit
Bug 37510: Make Koha::Object->delete throw Koha::Exception
authorTomas Cohen Arazi <tomascohen@theke.io>
Mon, 29 Jul 2024 12:16:56 +0000 (09:16 -0300)
committerLucas Gass <lucas@bywatersolutions.com>
Wed, 11 Sep 2024 16:41:16 +0000 (16:41 +0000)
commit3a95803c5e882fa28054337237d412528c1cc3c2
tree5608bc8cddf3b71977a83203ce53716b1eb14cd1
parent7edc1c10a8895f9da446e2f5d7a873cb0f179990
Bug 37510: Make Koha::Object->delete throw Koha::Exception

This patch makes Koha::Object->delete wrap DBIC exceptions on FK
constraints and throw a Koha::Exception::Object::FKConstraint exception
instead. This will allow us better handling it from the callers.

To test:
1. Apply the unit tests patch
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/Koha/Object.t
=> FAIL: A DBIC exception is thrown instead, tests fail
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass!
5. Sign off :-D

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 923dc5e078593f653b075813885bde34531c503e)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Koha/Exceptions/Object.pm
Koha/Object.pm