From 6deb51428ac3572650d582f5207e373fc64dd575 Mon Sep 17 00:00:00 2001 From: Aiden McClelland <3732071+dr-bonez@users.noreply.github.com> Date: Wed, 9 Nov 2022 12:29:06 -0700 Subject: [PATCH] fix error handling when store unreachable (#1925) Co-authored-by: Matt Hill --- .../projects/ui/src/app/services/marketplace.service.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/frontend/projects/ui/src/app/services/marketplace.service.ts b/frontend/projects/ui/src/app/services/marketplace.service.ts index 31acadd81..28e23a5f1 100644 --- a/frontend/projects/ui/src/app/services/marketplace.service.ts +++ b/frontend/projects/ui/src/app/services/marketplace.service.ts @@ -55,8 +55,8 @@ export class MarketplaceService implements AbstractMarketplaceService { mergeMap(([prev, curr]) => from(Object.entries(getNewEntries(prev, curr)))), mergeMap(([url, registry]) => this.fetchStore$(url).pipe( - map(data => { - if (data.info) this.updateStoreIdentifier(url, registry, data.info) + map(data => { + if (data?.info) this.updateStoreIdentifier(url, registry, data.info) return [url, data] }), @@ -156,12 +156,13 @@ export class MarketplaceService implements AbstractMarketplaceService { ) } - private fetchStore$(url: string): Observable { + private fetchStore$(url: string): Observable { return combineLatest([this.fetchInfo$(url), this.fetchPackages$(url)]).pipe( map(([info, packages]) => ({ info, packages })), catchError(e => { + console.error(e) this.requestErrors$.next(this.requestErrors$.value.concat(url)) - return of(e) + return of(null) }), ) }