https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42595
Bug ID: 42595
Summary: REST API: Holds controller renders bare strings
instead of error objects
Initiative type: ---
Sponsorship ---
status:
Product: Koha
Version: Main
Hardware: All
OS: All
Status: NEW
Severity: major
Priority: P5 - low
Component: REST API
Assignee: [email protected]
Reporter: [email protected]
QA Contact: [email protected]
CC: [email protected]
The Holds controller (Koha::REST::V1::Holds) has three places where
error responses are rendered as bare strings instead of the expected error
object (`{ error => "..." }`). This causes Mojolicious::Plugin::OpenAPI
response validation to fail with a 500:
{"errors":[{"message":"Expected object - got
string.","path":"/body"}],"status":500}
The error definition in the spec has always been `type: object`, so these
are latent bugs that surface when the specific code paths are hit.
Affected lines in Koha/REST/V1/Holds.pm:
1. Line 134: `openapi => "Bibliographic record not found"` (status 400)
- Triggered when biblio_id doesn't exist
2. Line 222: `openapi => 'Error placing the hold...'` (status 500)
- Triggered on unhandled exceptions during hold placement
3. Line 242: `openapi => ...to_api_mapping->{$broken_fk} . ' not found.'`
(status 404)
- Triggered on foreign key violations
All three should be:
`openapi => { error => $message }`
Found in production (25.11.02) when Aspen Discovery attempted to place a
hold on a deleted biblio (biblio_id that no longer exists in the database).
--
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/