added exception handling
This commit is contained in:
@@ -10,6 +10,7 @@ import { SearchResultsStateService } from '../modules/keywords-search/search-res
|
||||
import { CredentialService } from '../shared/services/credential.service';
|
||||
import { CompareItem } from '../modules/university-ranking/models/trend.models';
|
||||
import { cleanEntityId } from '../modules/university-ranking/utils/trend.utils';
|
||||
import { ErrorService } from '../shared/services/error.service';
|
||||
import {
|
||||
TrendDataService,
|
||||
TrendRequestParams,
|
||||
@@ -83,15 +84,6 @@ export const uniTrendResolver: ResolveFn<UniTrendResolvedData> = (
|
||||
}
|
||||
}
|
||||
|
||||
console.log('[TrendDebug] Resolver input params:', {
|
||||
fuzzy,
|
||||
searchType,
|
||||
urlTrendTopics: params.getAll('trend_topics'),
|
||||
urlTopics: params.getAll('topics'),
|
||||
urlKeywords: params.get('keywords') || params.getAll('keyword'),
|
||||
hasSearchState: !!searchState,
|
||||
});
|
||||
|
||||
if (searchState) {
|
||||
const stateTopics = fuzzy
|
||||
? searchState.topicsList()
|
||||
@@ -117,12 +109,6 @@ export const uniTrendResolver: ResolveFn<UniTrendResolvedData> = (
|
||||
keywords = topics;
|
||||
}
|
||||
|
||||
console.log('[TrendDebug] Resolver resolved topics & keywords:', {
|
||||
topics,
|
||||
keywords,
|
||||
searchType,
|
||||
});
|
||||
|
||||
// Parse comparison items ensuring clean uppercase OpenAlex IDs
|
||||
const instParams = params.getAll('institutions');
|
||||
const parsedInstitutions: CompareItem[] = instParams.map((i) => {
|
||||
@@ -163,8 +149,8 @@ export const uniTrendResolver: ResolveFn<UniTrendResolvedData> = (
|
||||
const countryIds = parsedCountries.map((c) => c.id);
|
||||
const regionIds = parsedRegions.map((r) => r.id);
|
||||
const authorIds = parsedAuthors.map((a) => a.id);
|
||||
|
||||
const apiService = inject(UniversityRankingsService);
|
||||
const errorService = inject(ErrorService);
|
||||
const personsService = inject(PersonsService, { optional: true });
|
||||
|
||||
const primaryTopic = topics[0] || 'Artificial Intelligence';
|
||||
@@ -205,7 +191,15 @@ export const uniTrendResolver: ResolveFn<UniTrendResolvedData> = (
|
||||
trendDataService.updateCache(res, currentParams);
|
||||
return res;
|
||||
}),
|
||||
catchError(() => of(null)),
|
||||
catchError((err) => {
|
||||
errorService.setError({
|
||||
statusCode: err?.status || 500,
|
||||
title: 'Visualisierungs-Fehler',
|
||||
message: 'Trenddaten konnten nicht geladen werden.',
|
||||
errorDetails: err?.message || String(err),
|
||||
});
|
||||
return of(null);
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user