Skip to main content

ErrorBoundary

Class Components

ErrorBoundary

An ErrorBoundary serves the purpose of catching and displaying errors when a component fails to load.

Param

the component that needs to load

Param

(optional) fallback component when error occurs

Param

(optional) object containing the error message and type

Param

(optional) log to the console if provided

Example

 <ErrorBoundary>
errorObj={{
type: 'script-error',
title: t('Error in loading reflection.'),
}}
>
<SomeChildComponent />
</ErrorBoundary>

Extends

Constructors

new ErrorBoundary()

new ErrorBoundary(props): ErrorBoundary

Parameters
ParameterType
propsErrorBoundaryProps
Returns

ErrorBoundary

Overrides

React.Component<ErrorBoundaryProps, ErrorBoundaryState>.constructor

Source

libs/design-system-core/src/components/ErrorBoundary/index.tsx:34

Methods

componentDidCatch()

componentDidCatch(error): void

Parameters
ParameterType
errorError
Returns

void

Overrides

React.Component.componentDidCatch

Source

libs/design-system-core/src/components/ErrorBoundary/index.tsx:39


render()

render(): Element

Returns

Element

Overrides

React.Component.render

Source

libs/design-system-core/src/components/ErrorBoundary/index.tsx:44

Components

withErrorBoundary()

withErrorBoundary<T>(WrappedComponent): (props) => Element

Type parameters

Type parameter
T extends ErrorBoundaryProps

Parameters

ParameterType
WrappedComponentComponentType<T>

Returns

Function

Parameters
ParameterType
propsT
Returns

Element

Source

libs/design-system-core/src/components/ErrorBoundary/index.tsx:60

Props

ErrorBoundaryProps

ErrorBoundaryProps: object

Type declaration

MemberType
childrenReact.ReactElement
errorObjPick <ErrorLoaderProps, "type" | "title">
fallbackReact.ReactElement
loggerILogger

Source

libs/design-system-core/src/components/ErrorBoundary/index.tsx:5


ErrorBoundaryState

ErrorBoundaryState: object

Type declaration

MemberType
errorError
hasErrorboolean

Source

libs/design-system-core/src/components/ErrorBoundary/index.tsx:12