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

Reject with error on http server error #256

Open
xyc opened this issue Jun 12, 2020 · 1 comment · May be fixed by #278
Open

Reject with error on http server error #256

xyc opened this issue Jun 12, 2020 · 1 comment · May be fixed by #278
Labels

Comments

@xyc
Copy link

xyc commented Jun 12, 2020

Use case: When the port is already in use (for example in 9856), the library throws an uncaughtException. This prevents the upstream consumer from further handling the error.

Proposed fix is to add following error handler after

reload/lib/reload.js

Lines 168 to 170 in c0271a6

httpOrHttpsServer.listen(port, function () {
resolve(getReloadReturn())
})

httpOrHttpsServer.on('error', function(error) {
    reject(error);
});

Reference:
https://stackoverflow.com/a/14470248

@alallier alallier added the bug label Jun 12, 2020
@alallier
Copy link
Owner

Thanks for the report, PRs welcomed

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