Project

General

Profile

Bug #18892

API server gives incorrect type of error message

Added by Ondřej Pražák over 1 year ago. Updated 10 days ago.

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

Description

Description of problem:

API sometimes gives Ruby error "undefined method `id' for nil:NilClass"

HTTP 500 error is more useful in this context.

Steps to Reproduce:

[root@rhel7-3-server ~]# curl H "Accept:application/json,version=2" -H "Content-Type:application/json" -X POST -u admin:password -k -d '{"architecture_id":"1","environment_name":"production", "domain_id":1, "mac":"00-00-5E-00-53-00", "location_id":1, "name":"test", "operatingsystem_id":"1","organization_id":"1" }' https://foreman.example.com/api/hosts | python -m json.tool
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 247 0 68 100 179 574 1513 -
:--:-- --:--:-- --:--:-- 1516 {
"error": {
"message": "undefined method `id' for nil:NilClass"
}
}

Actual results:

"error": {
"message": "undefined method `id' for nil:NilClass"

Expected results:

HTTP 500 Internal Error

Associated revisions

Revision f53bd444 (diff)
Added by Ondřej Pražák about 1 year ago

Fixes #18892 - Do not show 'undefined method' in error message

History

#1 Updated by Ondřej Pražák over 1 year ago

  • Subject changed from API server gives incorrect type of error message to API server gives incorrect type of error message
  • Category changed from Query interface to API
  • Assignee set to Ondřej Pražák

#2 Updated by The Foreman Bot over 1 year ago

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

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

  • Legacy Backlogs Release (now unused) set to 240

#4 Updated by Ondřej Pražák about 1 year ago

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

Also available in: Atom PDF