Skip to content

Commit 4c2f2dd

Browse files
authoredMar 1, 2017
use .call instead of .apply
In javascript `Function.prototype.apply()` expects an array as second argument. However, at the moment the error object instead of an array is passed to the `apply` method. So in this case, `Function.prototype.call()` makes for sense than `apply()`, because then you can pass arguments directly.
1 parent 7b8ed73 commit 4c2f2dd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed
 

‎lib/server.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ class Server extends events.EventEmitter {
154154
socket.on('error', (e) => {
155155
// ignore frequent ECONNRESET error (seems inevitable when refresh)
156156
if (e.code === 'ECONNRESET') return;
157-
this.error.apply(this, e);
157+
this.error.call(this, e);
158158
});
159159

160160
client.once('info', (data) => {

0 commit comments

Comments
 (0)
Please sign in to comment.