Added errro handling for the request.