(err)
| 333 | }); |
| 334 | |
| 335 | const onError = (err) => { |
| 336 | debug(class="st">"error"); |
| 337 | this.cleanup(); |
| 338 | this._readyState = class="st">"closed"; |
| 339 | this.emitReserved(class="st">"error", err); |
| 340 | if (fn) { |
| 341 | fn(err); |
| 342 | } else { |
| 343 | class="cm">// Only do this if there is no fn to handle the error |
| 344 | this.maybeReconnectOnOpen(); |
| 345 | } |
| 346 | }; |
| 347 | |
| 348 | class="cm">// emit `error` |
| 349 | const errorSub = on(socket, class="st">"error", onError); |
no test coverage detected