Bug 22051 - Make Koha::Object->store translate 'Incorrect <type> value' exceptions
Summary: Make Koha::Object->store translate 'Incorrect <type> value' exceptions
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Tomás Cohen Arazi (tcohen)
QA Contact: Josef Moravec
URL:
Keywords:
Depends on: 19828
Blocks: 22049
  Show dependency treegraph
 
Reported: 2018-12-28 14:15 UTC by Tomás Cohen Arazi (tcohen)
Modified: 2020-01-06 20:14 UTC (History)
7 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 22051: Add Koha::Exceptions::Object::WrongValue (3.38 KB, patch)
2018-12-28 15:21 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 22051: Unit tests (1.43 KB, patch)
2018-12-28 15:21 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 22051: Make Koha::Object->store translate incorrect value exceptions (1.51 KB, patch)
2018-12-28 15:21 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 22051: Add Koha::Exceptions::Object::WrongValue (3.42 KB, patch)
2019-01-03 16:27 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 22051: Unit tests (1.47 KB, patch)
2019-01-03 16:27 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 22051: Make Koha::Object->store translate incorrect value exceptions (1.55 KB, patch)
2019-01-03 16:27 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 22051: Add Koha::Exceptions::Object::WrongValue (3.48 KB, patch)
2019-01-04 19:44 UTC, Charles Farmer
Details | Diff | Splinter Review
Bug 22051: Unit tests (1.53 KB, patch)
2019-01-04 19:44 UTC, Charles Farmer
Details | Diff | Splinter Review
Bug 22051: Make Koha::Object->store translate incorrect value exceptions (1.61 KB, patch)
2019-01-04 19:44 UTC, Charles Farmer
Details | Diff | Splinter Review
Bug 22051: Add Koha::Exceptions::Object::WrongValue (3.53 KB, patch)
2019-01-08 18:19 UTC, Josef Moravec
Details | Diff | Splinter Review
Bug 22051: Unit tests (1.58 KB, patch)
2019-01-08 18:19 UTC, Josef Moravec
Details | Diff | Splinter Review
Bug 22051: Make Koha::Object->store translate incorrect value exceptions (1.67 KB, patch)
2019-01-08 18:19 UTC, Josef Moravec
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
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