Error Callback Arguments
I need to be able to handle specific failed Firebase writes due to permissions or missing Internet, please.
Is it not possible to catch the exceptions in this case? Otherwise the API needs to change
Won't the exception be thrown asynchronously?
Could you show me a simple example of how to catch a write exception that could be caused by either a permission error, or downed connection?
Do you need to be able to track it back to a particular write? I think that'll be hard with the exception.
We could enrich the exceptions as a stop gap, and I'll think about explicit error callback for the rewrite
As for providing sample code, will see if I have time this evening to knock out something from you
Yes, otherwise I can't tell the user if a particular action (like a form submit that triggers a write) failed and if they need to retry. Or maybe the write callback can be called with an additional error argument?
Thanks!
@pate Sorry, I haven't had time to look at this yet. Have you been able to work around it for now?
@pate have you figured this out?
I'm on the javascript API, .on seems to take a cancelCallback. My naive try is to pass in the regular callback as a cancelCallback too. https://github.com/Quantisan/matchbox/commit/5501ad557395aef7e4b4960582c0557d609bfc77 But that doesn't work at all. I'm getting a ref.key is not a function or something.
My use case is that I just need the async channel for listen-to< to return. Right now if there's an error, the channel doesn't return.
@Quantisan in your example is the listener being called at least? it's probably just tripping over the specifics of that decorated listener, which is build a tuple of the key/value, and making sure that value is Clojure(Script) data.
I have never actually used cancelCallback - the docs mention it being for when the user does not have permissions to a path. Is this your use case or are you perhaps interested in .onDisconnect / matchbox.core/on-disconnect?
@crisptrutski yes, my user might not have permission to access the data. Thanks for the tip. I'll figure this out next week.
@Quantisan have you progressed with this at all? I'd like to see if you found a solution before I go messing up the library 😝
@flyboarder frankly, it's been too long... so just go ahead. Thanks for checking!