REST: give a HTTP 500 error code if there's an unexpected error