From f3450d66a9deaf7c8203fda96a84a2f9ca8ba6ab Mon Sep 17 00:00:00 2001 From: Tilman Vatteroth Date: Sun, 14 Aug 2022 20:56:49 +0200 Subject: [PATCH] fix: suppress error when fetching user information in application loader Signed-off-by: Tilman Vatteroth --- .../application-loader/initializers/index.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/components/application-loader/initializers/index.ts b/src/components/application-loader/initializers/index.ts index 5d12b1b5c..6df08575d 100644 --- a/src/components/application-loader/initializers/index.ts +++ b/src/components/application-loader/initializers/index.ts @@ -11,6 +11,9 @@ import { fetchAndSetUser } from '../../login-page/auth/utils' import { fetchFrontendConfig } from './fetch-frontend-config' import { loadDarkMode } from './load-dark-mode' import { isDevMode, isTestMode } from '../../../utils/test-modes' +import { Logger } from '../../../utils/logger' + +const logger = new Logger('Application Loader') /** * Create a custom delay in the loading of the application. @@ -33,6 +36,14 @@ export interface InitTask { task: () => Promise } +const fetchUserInformation = async (): Promise => { + try { + await fetchAndSetUser() + } catch (error) { + logger.error("Couldn't load user. Probably not logged in.") + } +} + /** * Create a list of tasks, that need to be fulfilled on startup. */ @@ -52,7 +63,7 @@ export const createSetUpTaskList = (): InitTask[] => { }, { name: 'Fetch user information', - task: fetchAndSetUser + task: fetchUserInformation }, { name: 'Motd',