diff --git a/projects/nshmp-apps/src/app/gmm/spectra/services/app.service.ts b/projects/nshmp-apps/src/app/gmm/spectra/services/app.service.ts index 41e3a34c1b55973aa78d3ac97e7fcdc672d04e7f..f33ef5eb249da8806102be293bb0af2f24da4608 100644 --- a/projects/nshmp-apps/src/app/gmm/spectra/services/app.service.ts +++ b/projects/nshmp-apps/src/app/gmm/spectra/services/app.service.ts @@ -287,10 +287,20 @@ export class AppService this.nshmpService .callServices$<GmmSpectraResponse>(urls) - .pipe(catchError((error: Error) => this.nshmpService.throwError$(error))) + .pipe( + catchError((error: Error) => { + spinnerRef.close(); + return this.nshmpService.throwError$(error); + }), + ) .subscribe(serviceResponses => { - this.handleServiceResponses(serviceResponses); - spinnerRef.close(); + try { + this.handleServiceResponses(serviceResponses); + spinnerRef.close(); + } catch (error) { + spinnerRef.close(); + this.nshmpService.throwError$(error as Error); + } }); } @@ -521,7 +531,7 @@ export class AppService }) .sort((a, b) => a - b); - return xValues; + return [...xValues]; } private handleServiceResponses(serviceResponses: GmmSpectraResponse[]): void {