Skip to content
This repository has been archived by the owner on Jun 25, 2020. It is now read-only.

How to handle error ? #211

Open
ritwickdey opened this issue Mar 27, 2019 · 3 comments
Open

How to handle error ? #211

ritwickdey opened this issue Mar 27, 2019 · 3 comments

Comments

@ritwickdey
Copy link

There can be lot of reason for exception. (One example #199)

But I don't any way to handle error. A typical callback looks like cb(err, data). But in here the callback is cb(data) and if the function throws any error, I can't put any try..catch block as it's a callback operation. (async)

@ritwickdey
Copy link
Author

I not sure is this related #205 or not.

@ritwickdey
Copy link
Author

ritwickdey commented Mar 27, 2019

May be this tag will help

79b2e64?diff=split

@exupero
Copy link
Owner

exupero commented Mar 31, 2019

If the function you're calling returns a promise, you can attach an error-handling callback using the promise's .catch() method. If the function you're calling doesn't return a promise, I'll update it.

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

No branches or pull requests

2 participants