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.
Files changed (2) hide show
  1. package/bin/index.js +11 -1
  2. 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
- console.error(chalk.red(`Error: ${error.response.status} - ${error.response.data.message || error.response.data.error}`));
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cybersentinel-cli",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "CyberSentinel Cybersecurity Auditor CLI Tool",
5
5
  "main": "bin/index.js",
6
6
  "type": "commonjs",