HandleBadRequests function

Handle bad requests This Function is used to handle possible errors when trying to get url response.