handle 500 errors from the api server