agsh/yapople

ECONNRESET during fetch

Opened this issue · 2 comments

Hi! First of all I would like to thank you for this pretty good and simple LIB.

I'm getting sometimes ECONNRESET exception due my poor network. And even if the requested code is wrapped by a try-catch block, it seems to crash my node app. I guess some actions are happening in a different thread inside the, for example, retrieve method. Would it be possible?

Are you still having the issue? I know the cause and workaround, but thinking of making a PR for a better fix.
It comes from emit('error') and you are not catching the error
to fix it, you need to add on error handler in your client

Client.on('error', () => ()) for e.g.

It is been a while since I used the lib, but It is still good to know the way to fix it. Thanks you!