Closed florianbaethge closed 5 years ago
Hi!
Thanks for reporting. I will look at this really soon, and I will come back to you with some answer.
No, you are totally right, the behaviour you have described should be expected. I will investigate that problem, a little more deeply.
Maybe one remark here, you know that subscribe
is not needed to be called manually, don't you?
If you would like to subscribe your firebase calls manually, you should say API about that by calling: GdxFIRApp.setAutoSubscribePromises(false)
In your case,
GdxFIRDatabase.inst()
.inReference("/myapp/users/$uid")
.readValue(UserInformation::class.java)
.silentFail()
.then{ userInformation ->
Gdx.app.log(TAG, "Fetched user information for $uid: $userInformation")
userInformation?.let { info ->
listener.success(info)
} ?: run {
listener.empty()
}
}
should be good enough.
It even may occur the problem here, because whole promise flow is subscribed before you attach failure callback if there is some really fast fail it may be the case.
Can you check two things?
subscribe
to then
.fail(...)
before .subscribe()
I'm looking forward to getting some feedback from you :)
ookay, I've checked that, and the problem occurs because map<>pojo conversion is done after firebase api call, and fail callback doesn't catch that.
I will make some fix for it :)
I've tried with then()
before and also changed the order of fail()
... but it seems you found the cause... ;)
I must say, you are awesome! Cudos to the fast response times!
No problem.
The fix version 2.1.4 is already in deployment, so it should be available in a minutes
You are awesome!
P.s: You should add a PayPal donation button ;)
Describe the bug I am reading an object from the database. If a field of the object is of a different type in the POJO than in the database, it logically throws an exception within the API.
However, it never enters the
fail()
method of my promise, but still also thesubscribe()
Method.To Reproduce
Expected behavior The UserInformation class just constists of some nullable Float values. However, if one of the fields in the database is e.g. a String, it cannot be converted and throws and Exception in the API. Here, I would expect it to NOT go into
subscribe()
but call thefail()
method I supplied.However,
fail()
is never entered... Or am I doing something wrong here? (Btw: AddingsilentFail()
in the call didn't change anything)Platform (please check one of the following):
Smartphone (please complete the following information only if platform is Android or iOS):