Bug 29772

Summary: Make DELETE /patrons/:patron_id return error codes in error conditions
Product: Koha Reporter: Tomás Cohen Arazi <tomascohen>
Component: REST APIAssignee: Tomás Cohen Arazi <tomascohen>
Status: CLOSED FIXED QA Contact:
Severity: enhancement    
Priority: P5 - low CC: kyle
Version: unspecified   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
22.05.00
Bug Depends on: 28020, 29765    
Bug Blocks:    
Attachments: Bug 29772: Regression tests
Bug 29772: Make DELETE /patrons/:patron_id return error codes
Bug 29772: (follow-up) Document error codes
Bug 29772: Regression tests
Bug 29772: Make DELETE /patrons/:patron_id return error codes
Bug 29772: (follow-up) Document error codes
Bug 29772: Regression tests
Bug 29772: Make DELETE /patrons/:patron_id return error codes
Bug 29772: (follow-up) Document error codes

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 🦄