zek 14.2.72 → 14.2.73

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/fesm2020/zek.mjs CHANGED
@@ -1591,7 +1591,7 @@ class HttpErrorHandler {
1591
1591
  this.router = router;
1592
1592
  /** Create curried handleError function that already knows the service name */
1593
1593
  this.createHandleError = (serviceName = '') => (operation = 'operation', result = {}, show = true) => this.handleError(serviceName, operation, result, show);
1594
- this.createHandleErrorResult = (serviceName = '') => (operation = 'operation', show = true) => this.handleErrorResult(serviceName, operation, show);
1594
+ this.createHandleErrorResult = (serviceName = '') => (operation = 'operation', result = {}, show = true) => this.handleErrorResult(serviceName, operation, result, show);
1595
1595
  }
1596
1596
  /**
1597
1597
  * Returns a function that handles Http operation failures.
@@ -1607,7 +1607,6 @@ class HttpErrorHandler {
1607
1607
  if (show) {
1608
1608
  this.showError(serviceName, operation, response);
1609
1609
  }
1610
- //return throwError('Error! please try again later.');
1611
1610
  return of(result);
1612
1611
  };
1613
1612
  }
@@ -1618,7 +1617,7 @@ class HttpErrorHandler {
1618
1617
  * @param operation - name of the operation that failed
1619
1618
  * @param show - optional value to show error
1620
1619
  */
1621
- handleErrorResult(serviceName = '', operation = 'operation', show) {
1620
+ handleErrorResult(serviceName = '', operation = 'operation', result = {}, show) {
1622
1621
  return (response) => {
1623
1622
  console.error(response);
1624
1623
  if (show) {
@@ -1631,20 +1630,20 @@ class HttpErrorHandler {
1631
1630
  else {
1632
1631
  error = response.error;
1633
1632
  }
1634
- let result;
1633
+ let data;
1635
1634
  if (error instanceof ErrorEvent) {
1636
- result = { '': [response.error.message] };
1635
+ data = { '': [response.error.message] };
1637
1636
  }
1638
1637
  if (typeof error === 'string') {
1639
- result = { '': [response.error] };
1638
+ data = { '': [response.error] };
1640
1639
  }
1641
1640
  else if (typeof error === 'object') {
1642
1641
  const errors = error.traceId || error.success === false
1643
1642
  ? error.errors
1644
1643
  : error;
1645
- result = errors;
1644
+ data = errors;
1646
1645
  }
1647
- return of(result);
1646
+ return ObjectHelper.isDefined(data) ? of(data) : of(result);
1648
1647
  };
1649
1648
  }
1650
1649
  showError(serviceName, operation, response) {