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

View File

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