Added error handling to client.