Bug #5215
closed"bad request" exceptions and their messages are not displayed to hammer user
Description
Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1088442
Try creating an activation key using the same name/label as another. A generic "400 bad request" message is printed instead of indicating that the name is already in use (the server log contains this message).
Two fixes probably needed:
1. hammer-cli-foreman does not handle bad request
2. hammer-cli-katello should make sure the 'displayMessage' gets used in the error type (and all the others?)
or
katello needs to return json data in the same format as foreman does ('message'?)
Updated by Thomas McKay over 10 years ago
- Category set to Foreman commands (obsolete)
- Assignee set to Adam Price
- Priority changed from Normal to High
Updated by Tomáš Strachota over 10 years ago
Not sure if it's the same issue but I tried to fix the error handling in katello here (open PR):
https://github.com/Katello/hammer-cli-katello/pull/144
Commit:
https://github.com/tstrachota/hammer-cli-katello/commit/81d728b2239246edbc754f7037ea11a0f19528e4
Updated by David Davis over 10 years ago
Partha and I are still seeing this for 400 responses:
Error: 400 Bad Request
Even though the code is calling:
fail HttpErrors::BadRequest, _("Nice user error.")
And the body is returning:
{"displayMessage":"Nice user error.","errors":["Nice user error."]}
Updated by David Davis about 10 years ago
- Has duplicate Bug #4756: Bad request errors are not properly displayed in the CLI added
Updated by Tomáš Strachota about 10 years ago
I think the bad request handler is already in hammer-cli-katello https://github.com/Katello/hammer-cli-katello/blob/master/lib/hammer_cli_katello/exception_handler.rb#L29
Is the bug still valid? I was unable to reproduce.