mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-07 08:23:55 +00:00
48093b8651
* ux/54-help tooltips * ux/54-help refetch after mutation * ux/54-help broadcast event index * ux/54-help prevent multiple keypresses when key held * ux/54-help fat clock * ux/54-help progress bar user defined * ux/54-help onAir is button * ux/54-help OSC: add missing presenter message * ux/54-help OSC: enable / disable OSC * ux/54-help handle timezone in excel date import * ux/54-help tray left click to show app * ux/54-help create queriable endpoint * ux/54-help fix memoisation in lower thirds * ux/54-help revise icons * ux/54-help clarify text * ux/54-help forgiving text parsing * ux/54-help add smart keywords * ux/54-help version bump
34 lines
734 B
React
34 lines
734 B
React
import React from 'react';
|
|
import { LoggingContext } from '../../../app/context/LoggingContext';
|
|
|
|
class ErrorBoundary extends React.Component {
|
|
static contextType = LoggingContext;
|
|
|
|
constructor(props) {
|
|
super(props);
|
|
this.state = { error: null, errorInfo: null };
|
|
}
|
|
|
|
static getDerivedStateFromError(error) {
|
|
// Update state so next render shows fallback UI.
|
|
return { errorMessage: error.toString() };
|
|
}
|
|
|
|
componentDidCatch(error, info) {
|
|
this.setState({
|
|
error: error,
|
|
errorInfo: info,
|
|
});
|
|
this.context.emitError(error.toString());
|
|
}
|
|
|
|
render() {
|
|
if (this.state.errorMessage) {
|
|
return <p>:/</p>;
|
|
}
|
|
return this.props.children;
|
|
}
|
|
}
|
|
|
|
export default ErrorBoundary;
|