MG-RAST/Shock

More explicit error messages for bad node ids (and elsewhere?)

Closed this issue · 1 comments

Requesting a badly formatted or non-existent node returns a 500 Internal Server Error:

$ curl -X GET http://kbase.us/services/shock-api/node/9ae2658e-057f-4f89-81a1-a41c09c7313a
{"status":200,"data":{"id":"9ae2658e-057f-4f89-81a1-a41c09c7313a","version":"76a295479a82ddacee098be507bd31cf","file":{"name":"","size":0,"checksum":{},"format":"","virtual":false,"virtual_parts":null},"attributes":null,"indexes":{},"tags":null,"linkages":null},"error":null}
$ curl -X GET http://kbase.us/services/shock-api/node/9ae2658e-057f-4f89-81a1-a41c09c7313
{"status":500,"data":null,"error":["Internal Server Error"]}
$ curl -X GET http://kbase.us/services/shock-api/node/9ae2658e-057f-4f89-81a1-a41c09c7313b
{"status":500,"data":null,"error":["Internal Server Error"]}

A 500 makes it sound like there's a problem with the server itself - should probably be 400 with a 'Non existent node id' or 'Incorrect node format' error.

There may be other places in the code that have similarly opaque errors - I'll add to this issue if I find more.

I've addressed this issue. You now get an explicit error message. I've also introduced explicit error messages in many places throughout the cobebase.