Skip to content

Commit 59a34b1

Browse files
committed
fix: Handle error
1 parent 5cab2cf commit 59a34b1

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/app/catalogue/index/index.component.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ import {PageEnvService} from '@services/page-env.service';
1818
import {APIPicture, PictureService} from '@services/picture';
1919
import {getCatalogueSectionsTranslation} from '@utils/translations';
2020
import {combineLatest, EMPTY, Observable, of} from 'rxjs';
21-
import {debounceTime, distinctUntilChanged, map, shareReplay, switchMap, tap} from 'rxjs/operators';
21+
import {catchError, debounceTime, distinctUntilChanged, map, shareReplay, switchMap, tap} from 'rxjs/operators';
2222

2323
import {chunk, chunkBy} from '../../chunk';
24+
import {ToastsService} from '../../toasts/toasts.service';
2425
import {CatalogueService} from '../catalogue-service';
2526

2627
interface APIBrandSectionGroup {
@@ -90,6 +91,10 @@ export class CatalogueIndexComponent {
9091
}),
9192
);
9293
}),
94+
catchError((response: unknown) => {
95+
this.toastService.handleError(response);
96+
return EMPTY;
97+
}),
9398
switchMap((response) => {
9499
if (!response.items || response.items.length <= 0) {
95100
this.router.navigate(['/error-404'], {
@@ -188,5 +193,6 @@ export class CatalogueIndexComponent {
188193
private readonly catalogue: CatalogueService,
189194
private readonly itemsClient: ItemsClient,
190195
private readonly languageService: LanguageService,
196+
private readonly toastService: ToastsService,
191197
) {}
192198
}

0 commit comments

Comments
 (0)