https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42391
--- Comment #15 from Kyle M Hall (khall) <[email protected]> --- Created attachment 198622 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=198622&action=edit Bug 42391: (follow-up) Add NotNull, NotInStorage and UnhandledDBError translations Extend the ExceptionTranslator to handle two additional MySQL error patterns: - NOT NULL violations ('Column X cannot be null' and 'X doesn't have a default value') → Koha::Exceptions::Object::NotNull - Not in database errors → Koha::Exceptions::Object::NotInStorage Add Koha::Exceptions::Object::NotNull exception class with a property field identifying the offending column. Add Koha::Exceptions::Object::UnhandledDBError as a catch-all for DBI errors that don't match any known pattern. This closes the gap where unmatched MySQL errors could leak as DBIx::Class::Exception to callers (e.g. templates that no longer catch that type). The exception_action handler now distinguishes three cases: - Koha exception objects (from txn_do re-throws): passed through via 'die $msg' to preserve the original exception type. Without this, txn_do's rollback-and-rethrow would stringify the Koha exception and wrap it in UnhandledDBError, losing the specific type. - DBI errors (prefixed 'DBI Exception:'): translated if possible, otherwise wrapped in UnhandledDBError. - DBIC internal errors (e.g. 'Not in database'): translated if possible, otherwise thrown as DBIx::Class::Exception. Note: NotInStorage translation works for update operations but not for delete-on-detached-Row where DBIC bypasses the Schema's exception_action. Those cases remain DBIx::Class::Exception. Update tests: - OAIServers.t, Z3950Servers.t: assert NotNull with property check - Hold.t: assert NotNull, remove warn suppression hack - Objects.t: update-not-in-storage cases assert NotInStorage - Upload.t: delete-not-in-storage stays DBIx::Class::Exception Signed-off-by: David Nind <[email protected]> Signed-off-by: Kyle M Hall <[email protected]> -- You are receiving this mail because: You are watching all bug changes. _______________________________________________ Koha-bugs mailing list [email protected] https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
