Project

General

Profile

Actions

Bug #5215

closed

"bad request" exceptions and their messages are not displayed to hammer user

Added by Thomas McKay about 10 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
High
Assignee:
Category:
Foreman commands (obsolete)
Target version:
-
Difficulty:
Triaged:
Team Backlog:
Fixed in Releases:
Found in Releases:
In Kanboard:

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'?)


Related issues 1 (0 open1 closed)

Has duplicate Katello - Bug #4756: Bad request errors are not properly displayed in the CLIDuplicateDavid Davis03/20/2014Actions
Actions #1

Updated by Thomas McKay about 10 years ago

  • Category set to Foreman commands (obsolete)
  • Assignee set to Adam Price
  • Priority changed from Normal to High
Actions #2

Updated by Tomáš Strachota almost 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

Actions #3

Updated by David Davis almost 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."]}
Actions #4

Updated by David Davis over 9 years ago

  • Has duplicate Bug #4756: Bad request errors are not properly displayed in the CLI added
Actions #5

Updated by Tomáš Strachota over 9 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.

Actions #6

Updated by Adam Price over 9 years ago

  • Status changed from New to Closed
Actions

Also available in: Atom PDF