@socketsecurity/cli-with-sentry 1.1.7 → 1.1.8

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.
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.mts","sourceRoot":"","sources":["../../../src/utils/api.mts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAA;AACnE,OAAO,KAAK,EAEV,mBAAmB,EACnB,eAAe,EACf,sBAAsB,EACvB,MAAM,qBAAqB,CAAA;AAI5B,4DAA4D;AAC5D,wBAAgB,oBAAoB,IAAI,MAAM,GAAG,SAAS,CAQzD;AAED,wBAAsB,gCAAgC,CAAC,IAAI,EAAE,MAAM,mBAclE;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAChC,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAC9B,CAAA;AAED,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,mBAAmB,IAAI,OAAO,CAChE,sBAAsB,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAClC,CAAA;AAED,wBAAsB,aAAa,CAAC,CAAC,SAAS,mBAAmB,EAC/D,KAAK,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,EAClC,OAAO,CAAC,EAAE,oBAAoB,GAAG,SAAS,GACzC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAuE3B;AAED,wBAAsB,sBAAsB,CAAC,CAAC,SAAS,mBAAmB,EACxE,KAAK,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,EAClC,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CA+CrD;AAED,wB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AAC,CAkGrB"}
package/dist/utils.js CHANGED
@@ -409,7 +409,9 @@ async function handleApiCall(value, options) {
409
409
  require$$9.debugFn('error', `caught: Socket API request error`);
410
410
  }
411
411
  require$$9.debugDir('inspect', {
412
- error: e,
412
+ error: e
413
+ });
414
+ require$$9.debugDir('inspect', {
413
415
  socketSdkErrorResult
414
416
  });
415
417
  return socketSdkErrorResult;
@@ -452,11 +454,15 @@ async function handleApiCallNoSpinner(value, description) {
452
454
  error: e
453
455
  });
454
456
  const errStr = e ? String(e).trim() : '';
455
- const cause = errStr || NO_ERROR_MESSAGE;
457
+ const message = 'Socket API returned an error';
458
+ const rawCause = errStr || NO_ERROR_MESSAGE;
459
+ const cause = message !== rawCause ? rawCause : '';
456
460
  return {
457
461
  ok: false,
458
- message: 'Socket API returned an error',
459
- cause
462
+ message,
463
+ ...(cause ? {
464
+ cause
465
+ } : {})
460
466
  };
461
467
  }
462
468
 
@@ -524,25 +530,34 @@ async function queryApiSafeText(path, description) {
524
530
  if (description) {
525
531
  spinner.failAndStop(`An error was thrown while requesting ${description}.`);
526
532
  }
527
- const cause = e?.message;
528
533
  require$$9.debugFn('error', 'caught: await queryApi() error');
529
534
  require$$9.debugDir('inspect', {
530
535
  error: e
531
536
  });
537
+ const errStr = e ? String(e).trim() : '';
538
+ const message = 'API request failed';
539
+ const rawCause = errStr || NO_ERROR_MESSAGE;
540
+ const cause = message !== rawCause ? rawCause : '';
532
541
  return {
533
542
  ok: false,
534
- message: 'API Request failed to complete',
543
+ message,
535
544
  ...(cause ? {
536
545
  cause
537
546
  } : {})
538
547
  };
539
548
  }
540
549
  if (!result.ok) {
541
- const cause = await getErrorMessageForHttpStatusCode(result.status);
550
+ const {
551
+ status
552
+ } = result;
553
+ const reason = await getErrorMessageForHttpStatusCode(status);
542
554
  return {
543
555
  ok: false,
544
556
  message: 'Socket API returned an error',
545
- cause: `${result.statusText}${cause ? ` (cause: ${cause})` : ''}`
557
+ cause: `${result.statusText} (reason: ${reason})`,
558
+ data: {
559
+ code: status
560
+ }
546
561
  };
547
562
  }
548
563
  try {
@@ -558,8 +573,8 @@ async function queryApiSafeText(path, description) {
558
573
  });
559
574
  return {
560
575
  ok: false,
561
- message: 'API Request failed to complete',
562
- cause: 'There was an unexpected error trying to read the response text'
576
+ message: 'API request failed',
577
+ cause: 'Unexpected error reading response text'
563
578
  };
564
579
  }
565
580
  }
@@ -628,27 +643,33 @@ async function sendApiRequest(path, options) {
628
643
  if (description) {
629
644
  spinner.failAndStop(`An error was thrown while requesting ${description}.`);
630
645
  }
631
- const cause = e?.message;
632
646
  require$$9.debugFn('error', `caught: await fetch() ${method} error`);
633
647
  require$$9.debugDir('inspect', {
634
648
  error: e
635
649
  });
650
+ const errStr = e ? String(e).trim() : '';
651
+ const message = 'API request failed';
652
+ const rawCause = errStr || NO_ERROR_MESSAGE;
653
+ const cause = message !== rawCause ? rawCause : '';
636
654
  return {
637
655
  ok: false,
638
- message: 'API Request failed to complete',
656
+ message,
639
657
  ...(cause ? {
640
658
  cause
641
659
  } : {})
642
660
  };
643
661
  }
644
662
  if (!result.ok) {
645
- const cause = await getErrorMessageForHttpStatusCode(result.status);
663
+ const {
664
+ status
665
+ } = result;
666
+ const reason = await getErrorMessageForHttpStatusCode(status);
646
667
  return {
647
668
  ok: false,
648
669
  message: 'Socket API returned an error',
649
- cause: `${result.statusText}${cause ? ` (cause: ${cause})` : ''}`,
670
+ cause: `${result.statusText} (reason: ${reason})`,
650
671
  data: {
651
- code: result.status
672
+ code: status
652
673
  }
653
674
  };
654
675
  }
@@ -665,8 +686,8 @@ async function sendApiRequest(path, options) {
665
686
  });
666
687
  return {
667
688
  ok: false,
668
- message: 'API Request failed to complete',
669
- cause: 'There was an unexpected error trying to parse the response JSON'
689
+ message: 'API request failed',
690
+ cause: 'Unexpected error parsing response JSON'
670
691
  };
671
692
  }
672
693
  }
@@ -4117,5 +4138,5 @@ exports.toFilterConfig = toFilterConfig;
4117
4138
  exports.updateConfigValue = updateConfigValue;
4118
4139
  exports.walkNestedMap = walkNestedMap;
4119
4140
  exports.writeSocketJson = writeSocketJson;
4120
- //# debugId=91b76231-d3de-41db-ade8-3bf562c0e477
4141
+ //# debugId=737faea9-c80e-4b25-92fc-cf5802905b27
4121
4142
  //# sourceMappingURL=utils.js.map