userRef.child(userId).observeSingleEvent(of: .value, with: { snapshot in
//some codes
})
This is my code for getting some user data from the firebase database. My question is how to get the error if there is an error (like network error, request timeout, unknown error)? The observeSingleEvent has no completionBlock compared to others (setValue, updateValue etc.)
I also tried:
userRef.child(userId).observeSingleEvent(of: .value, with: {(snapshot) in
// print something
} , withCancel: {(error) in
// print something
})
still wont go inside withCancel.