/
QuickMeet
/
Chat.Desktop
Обзор
Документация
Войти
/
QuickMeet
/
Chat.Desktop
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/ui/components/utils/ErrorCatcher.tsx
28 строк
679 B
Tasso Evangelista
refactor!(deps): Bump all critical dependencies (#2803)
15 янв 2024, 17:33
Не верифицирован
15 янв 2024, 17:33
4b4f2ee
Код
Авторство
О чём код?
import type { ReactNode, ErrorInfo } from 'react'; import { Component } from 'react'; import { APP_ERROR_THROWN } from '../../../app/actions'; import { dispatch } from '../../../store'; type ErrorCatcherProps = { children?: ReactNode; }; export class ErrorCatcher extends Component<ErrorCatcherProps> { componentDidCatch(error: Error, errorInfo: ErrorInfo): void { console.error(error); console.error(errorInfo.componentStack); dispatch({ type: APP_ERROR_THROWN, payload: { message: error.message, stack: error.stack, name: error.name, }, }); } render() { return <>{this.props.children ?? null}</>; } }