fix error log when reconnect cycle fails

This commit is contained in:
tiagosiebler
2022-09-17 11:05:20 +01:00
parent 4ccaf853b6
commit 08674ab2fa
2 changed files with 14 additions and 8 deletions

View File

@@ -13,12 +13,12 @@ import { DefaultLogger, WS_KEY_MAP, WebsocketClient } from '../src';
{
// key: key,
// secret: secret,
// market: 'linear',
// market: 'inverse',
market: 'linear',
// market: 'spot',
// market: 'spotv3',
// market: 'usdcOption',
// market: 'usdcPerp',
market: 'usdcPerp',
// market: 'unifiedPerp',
// market: 'unifiedOption',
},
@@ -56,16 +56,20 @@ import { DefaultLogger, WS_KEY_MAP, WebsocketClient } from '../src';
// wsClient.subscribe('trade');
// Linear
wsClient.subscribe('trade.BTCUSDT');
// wsClient.subscribe('trade.BTCUSDT');
// Spot V3
// wsClient.subscribe('trade.BTCUSDT');
// usdc options
// wsClient.subscribe(`recenttrades.BTC`);
// wsClient.subscribe(`recenttrades.ETH`);
// wsClient.subscribe(`recenttrades.SOL`);
// wsClient.subscribe([
// `recenttrades.BTC`,
// `recenttrades.ETH`,
// `recenttrades.SOL`,
// ]);
// usdc perps
wsClient.subscribe('trade.BTCPERP');
// unified perps

View File

@@ -358,8 +358,10 @@ export class WebsocketClient extends EventEmitter {
default:
this.logger.error(
`{context} due to unexpected response error: ${error.msg}`,
{ ...loggerCategory, wsKey }
`${context} due to unexpected response error: "${
error?.msg || error?.message || error
}"`,
{ ...loggerCategory, wsKey, error }
);
break;
}