[PATCH 1/3] Make the api return 500 status code when something goes wrong.