cybersentinel-cli 1.0.1 → 1.0.2
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/bin/index.js +11 -1
- package/package.json +1 -1
package/bin/index.js
CHANGED
|
@@ -256,7 +256,17 @@ program
|
|
|
256
256
|
} catch (error) {
|
|
257
257
|
spinner.fail(chalk.red('Registration failed!'));
|
|
258
258
|
if (error.response) {
|
|
259
|
-
|
|
259
|
+
let msg = '';
|
|
260
|
+
if (typeof error.response.data === 'string') {
|
|
261
|
+
if (error.response.data.includes('The plain HTTP request was sent to HTTPS port')) {
|
|
262
|
+
msg = 'Plain HTTP request was sent to an HTTPS port. Please use "https://" instead of "http://".';
|
|
263
|
+
} else {
|
|
264
|
+
msg = error.response.data.substring(0, 150);
|
|
265
|
+
}
|
|
266
|
+
} else {
|
|
267
|
+
msg = error.response.data.message || error.response.data.error || JSON.stringify(error.response.data);
|
|
268
|
+
}
|
|
269
|
+
console.error(chalk.red(`Error: ${error.response.status} - ${msg}`));
|
|
260
270
|
} else {
|
|
261
271
|
console.error(chalk.red(`Error: ${error.message}`));
|
|
262
272
|
}
|