From dc2078ae5888860737fdc78de8e5e9a2f1d74566 Mon Sep 17 00:00:00 2001 From: Jake Fink Date: Wed, 11 May 2022 11:13:42 -0400 Subject: [PATCH] add better error handling to tax call (#1666) --- src/app/settings/tax-info.component.ts | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/src/app/settings/tax-info.component.ts b/src/app/settings/tax-info.component.ts index 0f7ff99266..f36feadde2 100644 --- a/src/app/settings/tax-info.component.ts +++ b/src/app/settings/tax-info.component.ts @@ -73,10 +73,14 @@ export class TaxInfoComponent { this.logService.error(e); } } else { - const taxInfo = await this.apiService.getTaxInfo(); - if (taxInfo) { - this.taxInfo.postalCode = taxInfo.postalCode; - this.taxInfo.country = taxInfo.country || "US"; + try { + const taxInfo = await this.apiService.getTaxInfo(); + if (taxInfo) { + this.taxInfo.postalCode = taxInfo.postalCode; + this.taxInfo.country = taxInfo.country || "US"; + } + } catch (e) { + this.logService.error(e); } } this.pristine = Object.assign({}, this.taxInfo); @@ -86,9 +90,16 @@ export class TaxInfoComponent { } }); - const taxRates = await this.apiService.getTaxRates(); - this.taxRates = taxRates.data; - this.loading = false; + try { + const taxRates = await this.apiService.getTaxRates(); + if (taxRates) { + this.taxRates = taxRates.data; + } + } catch (e) { + this.logService.error(e); + } finally { + this.loading = false; + } } get taxRate() {