Project

General

Profile

Bug #16813

Confusing error message on association not found error

Added by Marek Hulán over 4 years ago. Updated almost 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
API
Target version:
Difficulty:
Triaged:
Bugzilla link:
Fixed in Releases:
Found in Releases:

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 APIClosed2016-02-15
Related to Foreman - Bug #16846: Org create returns unclear message when trying to assign a non-existent subnetClosed2016-10-10

Associated revisions

Revision ead67f0d (diff)
Added by Marek Hulán over 4 years ago

Fixes #16813 - improve error messages for associations

Revision 2df46a2f (diff)
Added by Marek Hulán over 4 years ago

Fixes #16813 - improve error messages for associations

(cherry picked from commit ead67f0d679311187b6e6f9064a1d0bf3df70075)

History

#1 Updated by Marek Hulán over 4 years 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
  • Assignee set to Marek Hulán
  • Target version set to 1.5.0

not sure about proper category, please feel free to change

#2 Updated by Marek Hulán over 4 years ago

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

#3 Updated by The Foreman Bot over 4 years ago

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

#4 Updated by Dominic Cleal over 4 years ago

  • Category changed from Unattended installations to API
  • Legacy Backlogs Release (now unused) set to 190

#5 Updated by Marek Hulán over 4 years ago

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

#6 Updated by Dominic Cleal over 4 years ago

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

#7 Updated by Dominic Cleal over 4 years ago

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

#8 Updated by Dominic Cleal over 4 years ago

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

Also available in: Atom PDF