How to catch error when Firestore collection already exists?
问题 Right now my app is crashing when a collection already exists in Firebase Firestore. I want to catch this error when it happens, but my current implementation doesn't catch anything as the addSnapshotListener() method does not throw any error. Current Code let db = Firestore.firestore() do { try db.collection(chatName).addSnapshotListener { (Query, Error) in if Error != nil || Query?.documents != nil { let alert = UIAlertController(title: "Chat Name Already Exists", message: "This chat name