From e860186b4bb9bf7fbeaf3eb57c61fd39f49ed36e Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Mon, 1 Nov 2021 23:02:09 -0500 Subject: [PATCH] IntentionalError: display an ErrorBoundary preview at /error --- app/soapbox/features/intentional_error/index.js | 13 +++++++++++++ app/soapbox/features/ui/index.js | 2 ++ app/soapbox/features/ui/util/async-components.js | 4 ++++ 3 files changed, 19 insertions(+) create mode 100644 app/soapbox/features/intentional_error/index.js diff --git a/app/soapbox/features/intentional_error/index.js b/app/soapbox/features/intentional_error/index.js new file mode 100644 index 000000000..b3d7fa0f7 --- /dev/null +++ b/app/soapbox/features/intentional_error/index.js @@ -0,0 +1,13 @@ +import React from 'react'; + +/** + * IntentionalError: + * For testing logging/monitoring & previewing ErrorBoundary design. + */ +export default class IntentionalError extends React.Component { + + render() { + throw 'This error is intentional.'; + } + +} diff --git a/app/soapbox/features/ui/index.js b/app/soapbox/features/ui/index.js index 83f1bbbec..a16b12bf3 100644 --- a/app/soapbox/features/ui/index.js +++ b/app/soapbox/features/ui/index.js @@ -114,6 +114,7 @@ import { RegisterInvite, Share, NewStatus, + IntentionalError, } from './util/async-components'; // Dummy import, to make sure that ends up in the application bundle. @@ -317,6 +318,7 @@ class SwitchingColumnsArea extends React.PureComponent { + diff --git a/app/soapbox/features/ui/util/async-components.js b/app/soapbox/features/ui/util/async-components.js index 1e337f682..2223eeb92 100644 --- a/app/soapbox/features/ui/util/async-components.js +++ b/app/soapbox/features/ui/util/async-components.js @@ -421,3 +421,7 @@ export function Share() { export function NewStatus() { return import(/* webpackChunkName: "features/new_status" */'../../new_status'); } + +export function IntentionalError() { + return import(/* webpackChunkName: "error" */'../../intentional_error'); +}