From 81ef21a0c802f1d905f37a2a818544a8b400793c Mon Sep 17 00:00:00 2001 From: Renaud Chaput Date: Sat, 25 Feb 2023 14:34:32 +0100 Subject: [Glitch] Rename JSX files with proper `.jsx` extension Port 44a7d87cb1f5df953b6c14c16c59e2e4ead1bcb9 to glitch-soc Signed-off-by: Claire --- .../flavours/glitch/components/error_boundary.js | 134 --------------------- 1 file changed, 134 deletions(-) delete mode 100644 app/javascript/flavours/glitch/components/error_boundary.js (limited to 'app/javascript/flavours/glitch/components/error_boundary.js') diff --git a/app/javascript/flavours/glitch/components/error_boundary.js b/app/javascript/flavours/glitch/components/error_boundary.js deleted file mode 100644 index 8518dfc86..000000000 --- a/app/javascript/flavours/glitch/components/error_boundary.js +++ /dev/null @@ -1,134 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import { FormattedMessage } from 'react-intl'; -import { source_url } from 'flavours/glitch/initial_state'; -import { preferencesLink } from 'flavours/glitch/utils/backend_links'; -import StackTrace from 'stacktrace-js'; -import { Helmet } from 'react-helmet'; - -export default class ErrorBoundary extends React.PureComponent { - - static propTypes = { - children: PropTypes.node, - }; - - state = { - hasError: false, - errorMessage: undefined, - stackTrace: undefined, - mappedStackTrace: undefined, - componentStack: undefined, - }; - - componentDidCatch(error, info) { - this.setState({ - hasError: true, - errorMessage: error.toString(), - stackTrace: error.stack, - componentStack: info && info.componentStack, - mappedStackTrace: undefined, - }); - - StackTrace.fromError(error).then((stackframes) => { - this.setState({ - mappedStackTrace: stackframes.map((sf) => sf.toString()).join('\n'), - }); - }).catch(() => { - this.setState({ - mappedStackTrace: undefined, - }); - }); - } - - handleReload(e) { - e.preventDefault(); - window.location.reload(); - } - - render() { - const { hasError, errorMessage, stackTrace, mappedStackTrace, componentStack } = this.state; - - if (!hasError) return this.props.children; - - const likelyBrowserAddonIssue = errorMessage && errorMessage.includes('NotFoundError'); - - let debugInfo = ''; - if (stackTrace) { - debugInfo += 'Stack trace\n-----------\n\n```\n' + errorMessage + '\n' + stackTrace.toString() + '\n```'; - } - if (mappedStackTrace) { - debugInfo += 'Mapped stack trace\n-----------\n\n```\n' + errorMessage + '\n' + mappedStackTrace.toString() + '\n```'; - } - if (componentStack) { - if (debugInfo) { - debugInfo += '\n\n\n'; - } - debugInfo += 'React component stack\n---------------------\n\n```\n' + componentStack.toString() + '\n```'; - } - - let issueTracker = source_url; - if (source_url.match(/^https:\/\/github\.com\/[^/]+\/[^/]+\/?$/)) { - issueTracker = source_url + '/issues'; - } - - return ( -
-
-

-

- -

-
    - { likelyBrowserAddonIssue && ( -
  • - -
  • - ) } -
  • - }} - /> - { debugInfo !== '' && ( -
    - -