feat: log error in note-loading-boundary

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
Tilman Vatteroth 2023-04-05 11:23:25 +02:00
parent 6786e6d6d3
commit bd8a5861e7

View file

@ -5,6 +5,7 @@
*/ */
import { ApiError } from '../../../api/common/api-error' import { ApiError } from '../../../api/common/api-error'
import { ErrorToI18nKeyMapper } from '../../../api/common/error-to-i18n-key-mapper' import { ErrorToI18nKeyMapper } from '../../../api/common/error-to-i18n-key-mapper'
import { Logger } from '../../../utils/logger'
import { LoadingScreen } from '../../application-loader/loading-screen/loading-screen' import { LoadingScreen } from '../../application-loader/loading-screen/loading-screen'
import { CommonErrorPage } from '../../error-pages/common-error-page' import { CommonErrorPage } from '../../error-pages/common-error-page'
import { CustomAsyncLoadingBoundary } from '../async-loading-boundary/custom-async-loading-boundary' import { CustomAsyncLoadingBoundary } from '../async-loading-boundary/custom-async-loading-boundary'
@ -14,6 +15,8 @@ import { useLoadNoteFromServer } from './hooks/use-load-note-from-server'
import type { PropsWithChildren } from 'react' import type { PropsWithChildren } from 'react'
import React, { useEffect, useMemo } from 'react' import React, { useEffect, useMemo } from 'react'
const logger = new Logger('NoteLoadingBoundary')
/** /**
* Loads the note identified by the note-id in the URL. * Loads the note identified by the note-id in the URL.
* During the loading a {@link LoadingScreen loading screen} will be rendered instead of the child elements. * During the loading a {@link LoadingScreen loading screen} will be rendered instead of the child elements.
@ -37,6 +40,7 @@ export const NoteLoadingBoundary: React.FC<PropsWithChildren> = ({ children }) =
.withHttpCode(403, 'forbidden') .withHttpCode(403, 'forbidden')
.withHttpCode(401, 'forbidden') .withHttpCode(401, 'forbidden')
.orFallbackI18nKey('other') .orFallbackI18nKey('other')
logger.error(error)
return ( return (
<CommonErrorPage <CommonErrorPage
titleI18nKey={`${errorI18nKeyPrefix}.title`} titleI18nKey={`${errorI18nKeyPrefix}.title`}