Project

General

Profile

Actions

Bug #16813

closed

Confusing error message on association not found error

Added by Marek Hulán about 8 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
API
Target version:
Difficulty:
Triaged:
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 2 (0 open2 closed)

Related to Foreman - Bug #13704: Error when updating host location by name through APIClosedShlomi Zadok02/15/2016Actions
Related to Foreman - Bug #16846: Org create returns unclear message when trying to assign a non-existent subnetClosedAmit Karsale10/10/2016Actions
Actions

Also available in: Atom PDF