Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

udpate styling of error boundary #11

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

dvnrsn
Copy link

@dvnrsn dvnrsn commented Sep 28, 2020

No description provided.

if (typeof opts !== "object" || typeof opts.featureName !== "string") {
throw new Error(
"canopy-react-error-boundary decorator should be called with an opts object that has a featureName string. e.g. @ErrorBoundary({featureName: 'life'})"
);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only formatting changed

@@ -1,73 +1,74 @@
import React from 'react';
import {CprButton} from 'canopy-styleguide!sofe';
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

old

}

return function decorateComponent(Comp) {
return class CanopyReactErrorBoundary extends React.Component {
static displayName = `CanopyReactErrorBoundary(${opts.featureName})`
static getDerivedStateFromError(error) {
return { caughtError: true };
}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

this.setState({
caughtError: err,
caughtErrorInfo: info,
});
Copy link
Author

@dvnrsn dvnrsn Sep 29, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure why caughtErrorInfo was set in state 🤷 and caughtError should be in static getDerivedStateFromErr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant