Project

General

Profile

Actions

Bug #18892

closed

API server gives incorrect type of error message

Added by Ondřej Pražák over 7 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Normal
Category:
API
Target version:
Difficulty:
Triaged:
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

Actions #1

Updated by Ondřej Pražák over 7 years ago

  • Subject changed from API server gives incorrect type of error message to API server gives incorrect type of error message
  • Category changed from 19 to API
  • Assignee set to Ondřej Pražák
Actions #2

Updated by The Foreman Bot over 7 years ago

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

Updated by Marek Hulán over 7 years ago

  • Translation missing: en.field_release set to 240
Actions #4

Updated by Ondřej Pražák over 7 years ago

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

Also available in: Atom PDF