prevent 500 on catalog create with non-existing pool

this would lead to a 500 if pool w/ id=13 would not exist:

alias xmlcurl='curl --write-out "\nHTTP code: %{http_code}\n" --header
"Accept: application/xml" --header "Content-Type: application/xml"'

xmlcurl -X POST --user admin:password -k
  http://localhost:3000/api/catalogs --data
    '<catalog><name>haha</name><pool id="13"/></catalog>'

with the patch we get a 422 although the error message is not precise

+ a test for that
cleanup API error handling by introducing fn. render_api_error
cleanup shared_examples_for "http.*"
Merge pull request #434 from martinpovolny/api_fix_1

API fixes #1