[Bug 19828] New: Koha::Object-> store should catch DBIC exceptions and raise Koha::Exceptions
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19828 Bug ID: 19828 Summary: Koha::Object->store should catch DBIC exceptions and raise Koha::Exceptions Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Architecture, internals, and plumbing Assignee: koha-bugs@lists.koha-community.org Reporter: tomascohen@gmail.com QA Contact: testopia@bugs.koha-community.org DBIC exceptions are not suitable for reporting end users and API consumers the problems we find. They need to be parsed to find out the root cause of the problems. This could be done in Koha::Object-based classes (see bug 16330 for a discussion on this), but it should be handled more generically, in Koha::Object->store. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19828 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |benjamin.rokseth@kul.oslo.k | |ommune.no, | |jonathan.druart@bugs.koha-c | |ommunity.org, | |kyle@bywatersolutions.com, | |lari.taskula@jns.fi, | |nick@bywatersolutions.com Assignee|koha-bugs@lists.koha-commun |tomascohen@gmail.com |ity.org | -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19828 --- Comment #1 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 69857 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=69857&action=edit Bug 19828: Unit tests This patch introduces unit tests for the changes this bug introduces to Koha::Object->store. To test: - Apply this patch - Run: $ kshell k$ prove t/db_dependent/Koha/Object.t => FAIL: Tests should fail because the changes are not implemented on this patch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19828 --- Comment #2 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 69858 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=69858&action=edit Bug 19828: Make Koha::Object->store translate DBIC exceptions into Koha exceptions This patch introduces a try/catch block in store() and parses the error when an exceptional situation takes place. It only deals with FK constraint violations. The rest of the DBIC exceptions are rethrown. To test: - Apply this patch - Run: $ kshell k$ prove t/db_dependent/Koha/Object.t => SUCCESS: Tests pass! - Sign off :-D -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19828 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Small patch CC| |tomascohen@gmail.com Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19828 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #69857|0 |1 is obsolete| | --- Comment #3 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 69907 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=69907&action=edit Bug 19828: Unit tests This patch introduces unit tests for the changes this bug introduces to Koha::Object->store. To test: - Apply this patch - Run: $ kshell k$ prove t/db_dependent/Koha/Object.t => FAIL: Tests should fail because the changes are not implemented on this patch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19828 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #69858|0 |1 is obsolete| | --- Comment #4 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 69908 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=69908&action=edit Bug 19828: Make Koha::Object->store translate DBIC exceptions into Koha exceptions This patch introduces a try/catch block in store() and parses the error when an exceptional situation takes place. It only deals with FK constraint violations and duplicate IDs. The rest of the DBIC exceptions are rethrown. To test: - Apply this patch - Run: $ kshell k$ prove t/db_dependent/Koha/Object.t => SUCCESS: Tests pass! - Sign off :-D -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19828 --- Comment #5 from Tomás Cohen Arazi <tomascohen@gmail.com> --- I added the duplicate key use case. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19828 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |m.de.rooy@rijksmuseum.nl -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19828 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #69907|0 |1 is obsolete| | --- Comment #6 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 69963 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=69963&action=edit Bug 19828: Unit tests This patch introduces unit tests for the changes this bug introduces to Koha::Object->store. To test: - Apply this patch - Run: $ kshell k$ prove t/db_dependent/Koha/Object.t => FAIL: Tests should fail because the changes are not implemented on this patch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19828 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #69908|0 |1 is obsolete| | --- Comment #7 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 69964 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=69964&action=edit Bug 19828: Make Koha::Object->store translate DBIC exceptions into Koha exceptions This patch introduces a try/catch block in store() and parses the error when an exceptional situation takes place. It only deals with FK constraint violations and duplicate IDs. The rest of the DBIC exceptions are rethrown. To test: - Apply this patch - Run: $ kshell k$ prove t/db_dependent/Koha/Object.t => SUCCESS: Tests pass! - Sign off :-D -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19828 --- Comment #8 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 69965 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=69965&action=edit Bug 19828: Fix tests that expect DBD errors instead of the exception message -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19828 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |16330 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16330 [Bug 16330] REST API: add routes to add, update and delete patrons -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19828 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19828 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #69963|0 |1 is obsolete| | Attachment #69964|0 |1 is obsolete| | Attachment #69965|0 |1 is obsolete| | --- Comment #9 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 70048 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=70048&action=edit Bug 19828: Unit tests This patch introduces unit tests for the changes this bug introduces to Koha::Object->store. To test: - Apply this patch - Run: $ kshell k$ prove t/db_dependent/Koha/Object.t => FAIL: Tests should fail because the changes are not implemented on this patch Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19828 --- Comment #10 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 70049 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=70049&action=edit Bug 19828: Make Koha::Object->store translate DBIC exceptions into Koha exceptions This patch introduces a try/catch block in store() and parses the error when an exceptional situation takes place. It only deals with FK constraint violations and duplicate IDs. The rest of the DBIC exceptions are rethrown. To test: - Apply this patch - Run: $ kshell k$ prove t/db_dependent/Koha/Object.t => SUCCESS: Tests pass! - Sign off :-D Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19828 --- Comment #11 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 70050 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=70050&action=edit Bug 19828: Fix tests that expect DBD errors instead of the exception message Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19828 Josef Moravec <josef.moravec@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19828 Josef Moravec <josef.moravec@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #70048|0 |1 is obsolete| | Attachment #70049|0 |1 is obsolete| | Attachment #70050|0 |1 is obsolete| | --- Comment #12 from Josef Moravec <josef.moravec@gmail.com> --- Created attachment 70097 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=70097&action=edit Bug 19828: Unit tests This patch introduces unit tests for the changes this bug introduces to Koha::Object->store. To test: - Apply this patch - Run: $ kshell k$ prove t/db_dependent/Koha/Object.t => FAIL: Tests should fail because the changes are not implemented on this patch Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19828 --- Comment #13 from Josef Moravec <josef.moravec@gmail.com> --- Created attachment 70098 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=70098&action=edit Bug 19828: Make Koha::Object->store translate DBIC exceptions into Koha exceptions This patch introduces a try/catch block in store() and parses the error when an exceptional situation takes place. It only deals with FK constraint violations and duplicate IDs. The rest of the DBIC exceptions are rethrown. To test: - Apply this patch - Run: $ kshell k$ prove t/db_dependent/Koha/Object.t => SUCCESS: Tests pass! - Sign off :-D Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19828 --- Comment #14 from Josef Moravec <josef.moravec@gmail.com> --- Created attachment 70099 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=70099&action=edit Bug 19828: Fix tests that expect DBD errors instead of the exception message Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19828 --- Comment #15 from Josef Moravec <josef.moravec@gmail.com> --- Created attachment 70100 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=70100&action=edit Bug 19828: (QA follow-up) Fix rethrowing exception and move rethrowing out of 'if' statement just in case the exception does not came from DBIx::Class Signed-off-by: Josef Moravec <josef.moravec@gmail.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19828 Josef Moravec <josef.moravec@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |josef.moravec@gmail.com |y.org | CC| |josef.moravec@gmail.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19828 Josef Moravec <josef.moravec@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |19871 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19871 [Bug 19871] Use new exceptions Koha::Exceptions::Object::DuplicateID and FKConstraint -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19828 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to Master --- Comment #16 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Pushed to master for 18.05, thanks to everybody involved! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19828 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to Master |RESOLVED Resolution|--- |FIXED --- Comment #17 from Nick Clemens <nick@bywatersolutions.com> --- Enhancement, skipping for 17.11.x. Awesome work everybody! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19828 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |22051 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22051 [Bug 22051] Make Koha::Object->store translate 'Incorrect datetime value' exceptions -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org