Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/core/Context.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ class Context extends EventEmitter {
} else this.outgoingSocket.emit(kSendMessage, msg);
});

this.incomingSocket.on(kError, () => {
logger.error(`${INCOMING} [${this.connectionId}] [ERROR]`);
this.incomingSocket.on(kError, (error) => {
logger.error(`${INCOMING} [${this.connectionId}] [ERROR] ${error}`);
incrErrorConnectionCount();
});

Expand Down Expand Up @@ -182,8 +182,8 @@ class Context extends EventEmitter {
} else this.incomingSocket.emit(kSendMessage, msg);
});

this.outgoingSocket.on(kError, () => {
logger.error(`${OUTGOING} [${this.connectionId}] [ERROR]`);
this.outgoingSocket.on(kError, (error) => {
logger.error(`${OUTGOING} [${this.connectionId}] [ERROR] ${error}`);
incrErrorConnectionCount();
});

Expand Down
4 changes: 2 additions & 2 deletions lib/core/IncomingWebSocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ class IncomingWebSocket extends EventEmitter {
/**
* Triggers when error occured on socket.
*/
errorHandler() {
this.emit(kError);
errorHandler(error) {
this.emit(kError, error);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions lib/core/OutgoingWebSocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ class OutgoingWebSocket extends EventEmitter {
/**
* Triggers when error occured on socket.
*/
errorHandler() {
this.emit(kError);
errorHandler(error) {
this.emit(kError, error);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion test/core/incomingWebSocket.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ describe('IncomingWebSocket', () => {
it('should emit kError once', () => {
const emitSpy = spy();
incomingWs.emit = emitSpy;
incomingWs.errorHandler();
incomingWs.errorHandler('SOME ERROR');
assert(emitSpy.calledOnce);
assert(emitSpy.calledWith(kError));
});
Expand Down
2 changes: 1 addition & 1 deletion test/core/outgoingWebSocket.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ describe('OutgoingWebSocket', () => {
it('should emit kError', () => {
const errSpy = spy();
outgoingWs.emit = errSpy;
outgoingWs.errorHandler();
outgoingWs.errorHandler('SOME ERROR');
assert(errSpy.calledOnce);
});
});
Expand Down