@energycap/components 0.39.13 → 0.39.14-ECAP-24583-parse-bc-api-errors.20240409-0941

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.
@@ -6598,6 +6598,10 @@ function isApiError(errorResponse) {
6598
6598
  if (errorResponse.error && errorResponse.error.hasOwnProperty('status') && errorResponse.error.status.hasOwnProperty('message')) {
6599
6599
  return true;
6600
6600
  }
6601
+ // BillCAPture APIs return errors in a different format
6602
+ if (errorResponse.error && errorResponse.error.hasOwnProperty('message')) {
6603
+ return true;
6604
+ }
6601
6605
  return false;
6602
6606
  }
6603
6607
  class ErrorService {
@@ -6618,7 +6622,7 @@ class ErrorService {
6618
6622
  let apiErrorMessage = unknownErrorDefault || 'DefaultUnknownError_SC';
6619
6623
  if (errorResponse && isApiError(errorResponse)) {
6620
6624
  try {
6621
- apiErrorMessage = errorResponse.error.status.message;
6625
+ apiErrorMessage = errorResponse.error.status?.message || errorResponse.error.message;
6622
6626
  }
6623
6627
  catch (error) {
6624
6628
  //log the real error to the console (for developers) but just return the generic error to the user