]> git.koha-community.org Git - koha.git/commit
Bug 28020: Add error_code to error responses
authorTomas Cohen Arazi <tomascohen@theke.io>
Mon, 27 Dec 2021 11:27:24 +0000 (08:27 -0300)
committerFridolin Somers <fridolin.somers@biblibre.com>
Wed, 5 Jan 2022 23:33:46 +0000 (13:33 -1000)
commit8dee5083ebb1c72a8f3e848826374dfbc072551f
treeb1a28b4aff107978622db3c6af552909de648262
parent320437e7bd980779e44aa930b83741405f124fbb
Bug 28020: Add error_code to error responses

This patch adds the *error_code* attribute to the error response
definition. This way it can be added when returning an error.

I also made a sample usage of it on the generic unhandled_exception
helper, which the unit tests on this patchset expect.

To test:
1. Apply the unit tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/unhandled_exceptions.t
=> FAIL: The unhandled_exception() helper doesn't return an error_code
in the response payload.
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass!

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Koha/REST/Plugin/Exceptions.pm
api/v1/swagger/definitions/error.yaml