-
Notifications
You must be signed in to change notification settings - Fork 0
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
base: master
Are you sure you want to change the base?
Conversation
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'})" | ||
); |
There was a problem hiding this comment.
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'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
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 }; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.setState({ | ||
caughtError: err, | ||
caughtErrorInfo: info, | ||
}); |
There was a problem hiding this comment.
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
No description provided.