hedgequantx 2.9.26 → 2.9.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/pages/accounts.js +19 -2
package/package.json
CHANGED
package/src/pages/accounts.js
CHANGED
|
@@ -7,7 +7,7 @@ const ora = require('ora');
|
|
|
7
7
|
|
|
8
8
|
const { connections } = require('../services');
|
|
9
9
|
const { ACCOUNT_STATUS, ACCOUNT_TYPE } = require('../config');
|
|
10
|
-
const { getLogoWidth, getColWidths, drawBoxHeader, drawBoxFooter, draw2ColHeader, visibleLength, displayBanner, clearScreen } = require('../ui');
|
|
10
|
+
const { getLogoWidth, getColWidths, drawBoxHeader, drawBoxFooter, draw2ColHeader, visibleLength, displayBanner, clearScreen, centerText } = require('../ui');
|
|
11
11
|
const { prompts } = require('../utils');
|
|
12
12
|
|
|
13
13
|
/**
|
|
@@ -173,7 +173,24 @@ const showAccounts = async (service) => {
|
|
|
173
173
|
console.log();
|
|
174
174
|
|
|
175
175
|
} catch (error) {
|
|
176
|
-
if (spinner) spinner.
|
|
176
|
+
if (spinner) spinner.stop();
|
|
177
|
+
|
|
178
|
+
// Display error in a proper box
|
|
179
|
+
const W = boxWidth - 2;
|
|
180
|
+
console.log(chalk.cyan('╔' + '═'.repeat(W) + '╗'));
|
|
181
|
+
console.log(chalk.cyan('║') + chalk.yellow.bold(centerText('TRADING ACCOUNTS', W)) + chalk.cyan('║'));
|
|
182
|
+
console.log(chalk.cyan('╠' + '═'.repeat(W) + '╣'));
|
|
183
|
+
console.log(chalk.cyan('║') + ' '.repeat(W) + chalk.cyan('║'));
|
|
184
|
+
|
|
185
|
+
// Truncate error message to fit
|
|
186
|
+
let errMsg = (error.message || 'Unknown error').toUpperCase();
|
|
187
|
+
const maxLen = W - 4;
|
|
188
|
+
if (errMsg.length > maxLen) {
|
|
189
|
+
errMsg = errMsg.substring(0, maxLen - 3) + '...';
|
|
190
|
+
}
|
|
191
|
+
console.log(chalk.cyan('║') + chalk.red(centerText('ERROR: ' + errMsg, W)) + chalk.cyan('║'));
|
|
192
|
+
console.log(chalk.cyan('║') + ' '.repeat(W) + chalk.cyan('║'));
|
|
193
|
+
console.log(chalk.cyan('╚' + '═'.repeat(W) + '╝'));
|
|
177
194
|
}
|
|
178
195
|
|
|
179
196
|
await prompts.waitForEnter();
|