500 when creating child resources for parents that don't exist
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
craton |
New
|
Undecided
|
Unassigned |
Bug Description
Looks like we don't gracefully handle missing parents in the Craton API, so if someone tries to, say, create a cell for a region that doesn't exist, we get back a 500.
Example:
$ curl -s http://
{
"links": [...],
"regions": [
{
"created_at": "2017-02-
"id": 1,
"name": "ORD135",
"note": null,
"project_id": "b9f10eca-
"updated_at": null
},
{
"created_at": "2017-02-
"id": 2,
"name": "DFW",
"note": null,
"project_id": "b9f10eca-
"updated_at": null
}
]
}
Note there are only regions 1 and 2. Now try creating a cell for region 3, which doesn't exist.
$ curl -X POST -s http://
{
"message": "Unknown Error",
"status": 500
}
Error in API logs:
2017-02-24 20:52:16.609 192 ERROR craton.