Bug #16813

Confusing error message on association not found error

Added by Marek Hulán about 1 year ago. Updated about 1 year ago.

Status:Closed
Priority:Normal
Assigned To:Marek Hulán
Category:API
Target version:Team Marek Iteration 4
Difficulty: Bugzilla link:1379006
Found in release: Pull request:https://github.com/theforeman/foreman/pull/3923
Story points-
Velocity based estimate-
Release1.13.1Release relationshipAuto

Description

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1379006

Description of problem:

When association can't be found we don't render proper error message. For example if I use pxelinux instead of PXELinux template kind like this

curl -X POST https://admin:changeme@foreman.example.tst/api/config_templates -H 'Content-Type: application/json' -H 'ForemanApiVersion: 2' -d '{"config_template": { "name":"b", "template":"b","template_kind_name":"pxelinux" }}'

it renders

{
"error": {"message":"Resource config_template not found by id ''"}
}

While I would expect something like "Could not find template_kind with name: pxelinux". We should detect that the RecordNotFound
exception was triggered in has_many_common and adjust the error message accordingly.

Note that the original BZ was partly fixed by #13704 which fixed the backtrace but the error message remain confusing.


Related issues

Related to Foreman - Bug #13704: Error when updating host location by name through API Closed 02/15/2016
Related to Foreman - Bug #16846: Org create returns unclear message when trying to assign ... Closed 10/10/2016

Associated revisions

Revision ead67f0d
Added by Marek Hulán about 1 year ago

Fixes #16813 - improve error messages for associations

Revision 2df46a2f
Added by Marek Hulán about 1 year ago

Fixes #16813 - improve error messages for associations

(cherry picked from commit ead67f0d679311187b6e6f9064a1d0bf3df70075)

History

#1 Updated by Marek Hulán about 1 year ago

  • Subject changed from Confusing error message on association not found error to Confusing error message on association not found error
  • Status changed from New to Assigned
  • Assigned To set to Marek Hulán
  • Target version set to Team Marek Iteration 4

not sure about proper category, please feel free to change

#2 Updated by Marek Hulán about 1 year ago

  • Related to Bug #13704: Error when updating host location by name through API added

#3 Updated by The Foreman Bot about 1 year ago

  • Status changed from Assigned to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/3923 added

#4 Updated by Dominic Cleal about 1 year ago

  • Category changed from Unattended installations to API
  • Release set to 1.13.1

#5 Updated by Marek Hulán about 1 year ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#6 Updated by Dominic Cleal about 1 year ago

  • Duplicated by Bug #16846: Org create returns unclear message when trying to assign a non-existent subnet added

#7 Updated by Dominic Cleal about 1 year ago

  • Duplicated by deleted (Bug #16846: Org create returns unclear message when trying to assign a non-existent subnet)

#8 Updated by Dominic Cleal about 1 year ago

  • Related to Bug #16846: Org create returns unclear message when trying to assign a non-existent subnet added

Also available in: Atom PDF