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

When the server is unavailable, provide a way to handle promise rejection #5

Closed
fabianTMC opened this issue Apr 2, 2017 · 2 comments

Comments

@fabianTMC
Copy link

When I try to store a file when the server is offline, it logs the following error:

(node:16587) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: connect ECONNREFUSED 127
.0.0.1:9333

This is my code:

weedfs.write(file.stream)
.catch(function(err) {
    cb(err, null);
})
.then((fileInfo) => {
    cb(null, fileInfo.fid);
})

I've gone through the documentation but there is nothing mentioned about this. Any help would be appreciated.

@fabianTMC fabianTMC changed the title When the server is unavilable, provide a way to handle promise rejection When the server is unavailable, provide a way to handle promise rejection Apr 3, 2017
phal0r added a commit that referenced this issue Apr 3, 2017
@phal0r
Copy link
Collaborator

phal0r commented Apr 3, 2017

Hi @fabianTMC ,

thanks for reporting this. You are right, the Promise chain was broken during assignment requests and errors could not be catched. I refactored this and added a test for failing connections. Please have a look at v1.3.0 if it fits your use case.

@atroo
Copy link
Collaborator

atroo commented Oct 8, 2018

Fixed with 1.3.0

@atroo atroo closed this as completed Oct 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants