public static void getMember(String id, DataListener<Member> listener){
FirebaseAgent.getMemberDocumentReference(id).get().addOnSuccessListener(new OnSuccessListener<DocumentSnapshot>() {
@Override
public void onSuccess(DocumentSnapshot documentSnapshot) {
if (documentSnapshot.exists())
listener.onDataReady(documentSnapshot.toObject(Member.class));
else
listener.onDataNotFound(MEMBER_NOT_FOUND);
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
// .............. error identification ................
}
});
}
I want to build a helper function with returns that error Firebase throws and I want to store those errors inside an enum
Can someone help with this?