Bug 29772 - Make DELETE /patrons/:patron_id return error codes in error conditions
Summary: Make DELETE /patrons/:patron_id return error codes in error conditions
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: REST API (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Tomás Cohen Arazi
QA Contact:
URL:
Keywords:
Depends on: 28020 29765
Blocks:
  Show dependency treegraph
 
Reported: 2021-12-27 13:39 UTC by Tomás Cohen Arazi
Modified: 2022-01-07 11:31 UTC (History)
1 user (show)

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


Attachments
Bug 29772: Regression tests (3.00 KB, patch)
2021-12-27 14:41 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 29772: Make DELETE /patrons/:patron_id return error codes (3.38 KB, patch)
2021-12-27 14:41 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 29772: (follow-up) Document error codes (1.06 KB, patch)
2021-12-27 14:41 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 29772: Regression tests (3.05 KB, patch)
2021-12-31 17:17 UTC, David Nind
Details | Diff | Splinter Review
Bug 29772: Make DELETE /patrons/:patron_id return error codes (3.43 KB, patch)
2021-12-31 17:17 UTC, David Nind
Details | Diff | Splinter Review
Bug 29772: (follow-up) Document error codes (1.11 KB, patch)
2021-12-31 17:17 UTC, David Nind
Details | Diff | Splinter Review
Bug 29772: Regression tests (3.12 KB, patch)
2022-01-04 15:21 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 29772: Make DELETE /patrons/:patron_id return error codes (3.51 KB, patch)
2022-01-04 15:21 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 29772: (follow-up) Document error codes (1.18 KB, patch)
2022-01-04 15:21 UTC, Jonathan Druart
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 2021-12-27 13:39:34 UTC
Bug 28020 introduces the option to return error codes instead of just textual descriptions. Let's use that!
Comment 1 Tomás Cohen Arazi 2021-12-27 14:41:43 UTC
Created attachment 128924 [details] [review]
Bug 29772: Regression tests
Comment 2 Tomás Cohen Arazi 2021-12-27 14:41:47 UTC
Created attachment 128925 [details] [review]
Bug 29772: Make DELETE /patrons/:patron_id return error codes

This patch makes the controller add the error_code attribute on error
conditions payload.

To test:
1. Apply the regression tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/patrons.t
=> FAIL: Boo, the API doesn't include the error_code attribute on the
error responses for the DELETE /patrons/:patron_id route
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass! error_code is included in the response!
5. Sign off :-D
Comment 3 Tomás Cohen Arazi 2021-12-27 14:41:51 UTC
Created attachment 128926 [details] [review]
Bug 29772: (follow-up) Document error codes
Comment 4 David Nind 2021-12-31 17:17:02 UTC
Created attachment 128941 [details] [review]
Bug 29772: Regression tests

Signed-off-by: David Nind <david@davidnind.com>
Comment 5 David Nind 2021-12-31 17:17:06 UTC
Created attachment 128942 [details] [review]
Bug 29772: Make DELETE /patrons/:patron_id return error codes

This patch makes the controller add the error_code attribute on error
conditions payload.

To test:
1. Apply the regression tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/patrons.t
=> FAIL: Boo, the API doesn't include the error_code attribute on the
error responses for the DELETE /patrons/:patron_id route
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass! error_code is included in the response!
5. Sign off :-D

Signed-off-by: David Nind <david@davidnind.com>
Comment 6 David Nind 2021-12-31 17:17:11 UTC
Created attachment 128943 [details] [review]
Bug 29772: (follow-up) Document error codes

Signed-off-by: David Nind <david@davidnind.com>
Comment 7 Jonathan Druart 2022-01-04 15:21:27 UTC
Created attachment 129001 [details] [review]
Bug 29772: Regression tests

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 8 Jonathan Druart 2022-01-04 15:21:30 UTC
Created attachment 129002 [details] [review]
Bug 29772: Make DELETE /patrons/:patron_id return error codes

This patch makes the controller add the error_code attribute on error
conditions payload.

To test:
1. Apply the regression tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/patrons.t
=> FAIL: Boo, the API doesn't include the error_code attribute on the
error responses for the DELETE /patrons/:patron_id route
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass! error_code is included in the response!
5. Sign off :-D

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 9 Jonathan Druart 2022-01-04 15:21:34 UTC
Created attachment 129003 [details] [review]
Bug 29772: (follow-up) Document error codes

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 10 Fridolin Somers 2022-01-05 23:35:36 UTC
Pushed to master for 22.05, thanks to everybody involved 🦄