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

Added "error" event listener #2570

Merged
merged 3 commits into from May 29, 2015
Merged

Added "error" event listener #2570

merged 3 commits into from May 29, 2015

Conversation

@arb
Copy link
Contributor

@arb arb commented May 28, 2015

Added error listener to listener object. Closes #2561.

@kanongil
Copy link
Contributor

@kanongil kanongil commented May 28, 2015

This approach can cause the callback to be triggered multiple times if an error is triggered on the listener for some other reason at a date after the listening event has been triggered.

You should probably also change Connection#info.started to 0, to indicate that it stopped running.

@arb
Copy link
Contributor Author

@arb arb commented May 28, 2015

@kanongil Yeah I knew 😞. I thought it was unlikely that it WOULD occur, but you're right, it COULD occur.

I think I have a solution that isn't vulnerable to that. I also though about trying to call _stop on error but I'm not sure if we really need to do that.

@Marsup
Copy link
Contributor

@Marsup Marsup commented May 28, 2015

Why don't you unregister that listener once the server is started ?

@@ -149,12 +149,26 @@ internals.Connection.prototype._start = function (callback) {
return process.nextTick(callback);
}

var self = this;
var startupErr = function (err) {
Copy link
Contributor

@hueniverse hueniverse May 28, 2015

Event handler should be called onError

@hueniverse hueniverse added the bug label May 28, 2015
@hueniverse hueniverse self-assigned this May 28, 2015
@hueniverse hueniverse added this to the 8.5.3 milestone May 28, 2015
@hueniverse hueniverse removed this from the 8.5.3 milestone May 29, 2015
@@ -149,12 +149,26 @@ internals.Connection.prototype._start = function (callback) {
return process.nextTick(callback);
}

var self = this;
Copy link
Contributor

@hueniverse hueniverse May 29, 2015

self always at top of function with empty line.

@hueniverse hueniverse added this to the 8.6.0 milestone May 29, 2015
hueniverse pushed a commit that referenced this issue May 29, 2015
Added "error" event listener
@hueniverse hueniverse merged commit 7edc108 into hapijs:master May 29, 2015
1 check passed
@arb arb deleted the error branch May 29, 2015
@lock
Copy link

@lock lock bot commented Jan 9, 2020

This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

4 participants