aboutsummaryrefslogtreecommitdiffstats
path: root/packages/connect/src/ws_orderbook_channel.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/connect/src/ws_orderbook_channel.ts')
-rw-r--r--packages/connect/src/ws_orderbook_channel.ts17
1 files changed, 12 insertions, 5 deletions
diff --git a/packages/connect/src/ws_orderbook_channel.ts b/packages/connect/src/ws_orderbook_channel.ts
index e6a1322d2..e5d31607a 100644
--- a/packages/connect/src/ws_orderbook_channel.ts
+++ b/packages/connect/src/ws_orderbook_channel.ts
@@ -69,15 +69,18 @@ export class WebSocketOrderbookChannel implements OrderbookChannel {
}
private _handleWebSocketMessage(message: any): void {
if (_.isUndefined(message.data)) {
- this._handler.onError(this, new Error(`Message does not contain utf8Data`));
+ this._handler.onError(this, new Error(`Message does not contain data. Url: ${this._client.url}`));
return;
}
try {
- const utf8Data = message.data;
- const parserResult = orderbookChannelMessageParser.parse(utf8Data);
+ const data = message.data;
+ const parserResult = orderbookChannelMessageParser.parse(data);
const subscriptionOpts = this._subscriptionOptsList[parserResult.requestId];
if (_.isUndefined(subscriptionOpts)) {
- this._handler.onError(this, new Error(`Message has unknown requestId: ${utf8Data}`));
+ this._handler.onError(
+ this,
+ new Error(`Message has unknown requestId. Url: ${this._client.url} Message: ${data}`),
+ );
return;
}
switch (parserResult.type) {
@@ -90,7 +93,11 @@ export class WebSocketOrderbookChannel implements OrderbookChannel {
break;
}
default: {
- this._handler.onError(this, new Error(`Message has unknown type parameter: ${utf8Data}`));
+ this._handler.onError(
+ this,
+ new Error(`Message has unknown type parameter. Url: ${this._client.url} Message: ${data}`),
+ subscriptionOpts,
+ );
}
}
} catch (error) {