Bugzilla – Attachment 83536 Details for
Bug 22051
Make Koha::Object->store translate 'Incorrect <type> value' exceptions
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22051: Make Koha::Object->store translate incorrect value exceptions
Bug-22051-Make-KohaObject-store-translate-incorrec.patch (text/plain), 1.51 KB, created by
Tomás Cohen Arazi (tcohen)
on 2018-12-28 15:21:43 UTC
(
hide
)
Description:
Bug 22051: Make Koha::Object->store translate incorrect value exceptions
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2018-12-28 15:21:43 UTC
Size:
1.51 KB
patch
obsolete
>From c494fccdfacb3698ac0a0e7248938c89d2d00235 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Fri, 28 Dec 2018 12:15:53 -0300 >Subject: [PATCH] Bug 22051: Make Koha::Object->store translate incorrect value > exceptions > >This patch adds a new condition to Koha::Object->store so it catches >incorrect value-related DBIC exceptions. > >This DBIC exceptions get now translated into >Koha::Exceptions::Object::BadValue exceptions with relevant parameters >passed. > >To test: >- Apply the exception and unit tests patches >- Run: > $ kshell > k$ prove t/db_dependent/Koha/Object.t >=> FAIL: Tests fail because this exception handling code is not >implemented >- Apply this patch >- Run: > k$ prove t/db_dependent/Koha/Object.t >=> SUCCESS: Tests pass! >- Sign off :-D >--- > Koha/Object.pm | 7 +++++++ > 1 file changed, 7 insertions(+) > >diff --git a/Koha/Object.pm b/Koha/Object.pm >index 2dc135e2d1..98867d29d0 100644 >--- a/Koha/Object.pm >+++ b/Koha/Object.pm >@@ -143,6 +143,13 @@ sub store { > duplicate_id => $+{key} > ); > } >+ elsif( $_->{msg} =~ /Incorrect (?<type>\w+) value: '(?<value>.*)' for column '(?<property>\w+)'/ ) { >+ Koha::Exceptions::Object::BadValue->throw( >+ type => $+{type}, >+ value => $+{value}, >+ property => $+{property} >+ ); >+ } > } > # Catch-all for foreign key breakages. It will help find other use cases > $_->rethrow(); >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 22051
:
83534
|
83535
|
83536
|
83622
|
83623
|
83624
|
83657
|
83658
|
83659
|
83723
|
83724
|
83725