Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error Callback Arguments #40

Open
theronic opened this issue Sep 21, 2015 · 11 comments
Open

Error Callback Arguments #40

theronic opened this issue Sep 21, 2015 · 11 comments

Comments

@theronic
Copy link
Collaborator

I need to be able to handle specific failed Firebase writes due to permissions or missing Internet, please.

@crisptrutski
Copy link
Owner

Is it not possible to catch the exceptions in this case? Otherwise the API needs to change

@theronic
Copy link
Collaborator Author

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?

@crisptrutski
Copy link
Owner

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

@theronic
Copy link
Collaborator Author

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!

@crisptrutski
Copy link
Owner

@pate Sorry, I haven't had time to look at this yet. Have you been able to work around it for now?

@Quantisan
Copy link
Contributor

@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. Quantisan@5501ad5 But that doesn't work at all. I'm getting a ref.key is not a function or something.

@Quantisan
Copy link
Contributor

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.

@crisptrutski
Copy link
Owner

@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?

@Quantisan
Copy link
Contributor

@crisptrutski yes, my user might not have permission to access the data. Thanks for the tip. I'll figure this out next week.

@crisptrutski crisptrutski added this to the 0.1.0 milestone Mar 15, 2016
@burn2delete
Copy link
Contributor

@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 😝

@Quantisan
Copy link
Contributor

@flyboarder frankly, it's been too long... so just go ahead. Thanks for checking!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants