2.0.6 • Published 4 years ago

error-boundary-jsx v2.0.6

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

npm npm bundle size Build Status codecov dependabot badge semantic-release Commitizen friendly

error-boundary-jsx

Handle errors on wrapped component and provide a fall back.

yarn add error-boundary-jsx

# or with npm

npm install error-boundary-jsx --save

<ErrorBoundary /> Component (Recommended)

Handle errors for specific use case of component.

import ErrorBoundary from 'error-boundary-jsx'

<ErrorBoundary onError={componentErrorHandler} name="component name" FallbackComponent={CustomFallbackComponent}>
    ...component tree to handle errors
</ErrorBoundary>

withErrorBoundary() HOC

HOC for error handling every use case of a component.

import withErrorBoundary from 'error-boundary-jsx'

const componentErrorHandler = {
    handleComponentError(error: Error, name: string, stack: string): void {
        ...log error
    }
}

withErrorBoundary(Component, componentErrorHandler)
API
proptyperequireddefaultValueDescription
componentReact.ComponentTypetrue-A component that we want to bind error boundary jsx to
namestringtrue-Component name to identify in stack message
onError(name: string, error: Error, stack: string) => voidtrue-Error callback handler
FallbackComponentReact.ComponentTypefalse-A fallback component when error occurs
2.0.6

4 years ago

2.0.5

4 years ago

2.0.4

4 years ago

2.0.3

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago