Bug 22051

Summary: Make Koha::Object->store translate 'Incorrect <type> value' exceptions
Product: Koha Reporter: Tomás Cohen Arazi (tcohen) <tomascohen>
Component: Architecture, internals, and plumbingAssignee: Tomás Cohen Arazi (tcohen) <tomascohen>
Status: CLOSED FIXED QA Contact: Josef Moravec <josef.moravec>
Severity: enhancement    
Priority: P5 - low CC: fridolin.somers, jonathan.druart, josef.moravec, lucas, martin.renvoize, nick, tomascohen
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on: 19828    
Bug Blocks: 22049    
Attachments: Bug 22051: Add Koha::Exceptions::Object::WrongValue
Bug 22051: Unit tests
Bug 22051: Make Koha::Object->store translate incorrect value exceptions
Bug 22051: Add Koha::Exceptions::Object::WrongValue
Bug 22051: Unit tests
Bug 22051: Make Koha::Object->store translate incorrect value exceptions
Bug 22051: Add Koha::Exceptions::Object::WrongValue
Bug 22051: Unit tests
Bug 22051: Make Koha::Object->store translate incorrect value exceptions
Bug 22051: Add Koha::Exceptions::Object::WrongValue
Bug 22051: Unit tests
Bug 22051: Make Koha::Object->store translate incorrect value exceptions

Description Tomás Cohen Arazi (tcohen) 2018-12-28 14:15:30 UTC
Currently, Koha::Object->store only handles FK and duplicate key problems. It should handle wrong format errors.
Comment 1 Tomás Cohen Arazi (tcohen) 2018-12-28 15:21:37 UTC Comment hidden (obsolete)
Comment 2 Tomás Cohen Arazi (tcohen) 2018-12-28 15:21:40 UTC Comment hidden (obsolete)
Comment 3 Tomás Cohen Arazi (tcohen) 2018-12-28 15:21:43 UTC Comment hidden (obsolete)
Comment 4 Owen Leonard 2019-01-03 16:27:27 UTC Comment hidden (obsolete)
Comment 5 Owen Leonard 2019-01-03 16:27:32 UTC Comment hidden (obsolete)
Comment 6 Owen Leonard 2019-01-03 16:27:36 UTC Comment hidden (obsolete)
Comment 7 Charles Farmer 2019-01-04 19:44:32 UTC
Created attachment 83657 [details] [review]
Bug 22051: Add Koha::Exceptions::Object::WrongValue

This patch adds a new exception to be thrown in Koha::Object->store when
a DBIC exception is thrown regarding bad data format.

To test:
- Apply this patch
- Run:
  $ kshell
 k$ prove t/Koha/Exceptions.t
=> SUCCESS: Tests pass!
- Sign off :-D

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Charles Farmer <charles.farmer@inLibro.com>
Comment 8 Charles Farmer 2019-01-04 19:44:37 UTC
Created attachment 83658 [details] [review]
Bug 22051: Unit tests

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Charles Farmer <charles.farmer@inLibro.com>
Comment 9 Charles Farmer 2019-01-04 19:44:42 UTC
Created attachment 83659 [details] [review]
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

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Charles Farmer <charles.farmer@inLibro.com>
Comment 10 Josef Moravec 2019-01-08 18:19:32 UTC
Created attachment 83723 [details] [review]
Bug 22051: Add Koha::Exceptions::Object::WrongValue

This patch adds a new exception to be thrown in Koha::Object->store when
a DBIC exception is thrown regarding bad data format.

To test:
- Apply this patch
- Run:
  $ kshell
 k$ prove t/Koha/Exceptions.t
=> SUCCESS: Tests pass!
- Sign off :-D

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Charles Farmer <charles.farmer@inLibro.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 11 Josef Moravec 2019-01-08 18:19:36 UTC
Created attachment 83724 [details] [review]
Bug 22051: Unit tests

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Charles Farmer <charles.farmer@inLibro.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 12 Josef Moravec 2019-01-08 18:19:40 UTC
Created attachment 83725 [details] [review]
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

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Charles Farmer <charles.farmer@inLibro.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 13 Nick Clemens (kidclamp) 2019-01-25 20:50:07 UTC
Awesome work all!

Pushed to master for 19.05
Comment 14 Martin Renvoize (ashimema) 2019-01-31 17:14:25 UTC
Developer aid, backporting to 18.11.x for 18.11.03
Comment 15 Lucas Gass (lukeg) 2019-02-05 20:25:13 UTC
enhancement not backporting to 18.05.x