import * as React from 'react'; export default class ErrorBoundary extends React.Component { state:any = { error: null, errorInfo: null }; componentDidCatch(error:any, errorInfo:any) { this.setState({ error: error, errorInfo: errorInfo }); } render() { if (this.state.error) { try { const output = []; output.push(

Message

); output.push(

{this.state.error.message}

); if (this.state.error.stack) { output.push(

Stack trace

); output.push(
{this.state.error.stack}
); } if (this.state.errorInfo) { if (this.state.errorInfo.componentStack) { output.push(

Component stack

); output.push(
{this.state.errorInfo.componentStack}
); } } return (

Error

Joplin encountered a fatal error and could not continue. To report the error, please copy the *entire content* of this page and post it on Joplin forum or GitHub.

{output}
); } catch (error) { return (
{JSON.stringify(this.state)}
); } } return this.props.children; } }