handle the response and req errors