Skip to content

Commit ce3232c

Browse files
author
Khang Nghi Lam
committed
error handling
1 parent 7c6888d commit ce3232c

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Diff for: src/index.js

+10-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ class FloatClient extends EventEmitter {
3636

3737
this._client.on('logOnResponse', response => {
3838
if (response.eresult !== EResult.OK) {
39-
if (this.debug) { console.log('[login failed]') }
39+
if (this.debug) {
40+
console.log(response.eresult)
41+
console.log('[login failed]')
42+
}
4043
return this.emit('disconnected')
4144
}
4245

@@ -113,7 +116,12 @@ class FloatClient extends EventEmitter {
113116
if (this.debug) { console.log('[message]', type) }
114117

115118
if (type === 4004) { this._gcLoaded() }
116-
if (type === 9157) { this._decodeFloat(header, buffer) }
119+
if (type === 9157) {
120+
this._decodeFloat(header, buffer)
121+
}
122+
else{
123+
if (this._defer) { return this._defer.resolve(null) }
124+
}
117125
if (callback) { callback(header, buffer) }
118126
}
119127

0 commit comments

Comments
 (0)