Download wp-calypso/client/reader/components/crowdsignal-poll/error-boundary.tsx from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 844 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/reader/components/crowdsignal-poll/error-boundary.tsx
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/reader/components/crowdsignal-poll/error-boundary.tsx
-
curl -L -o error-boundary.tsx https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/reader/components/crowdsignal-poll/error-boundary.tsx
844 Bytes
| import config from '@automattic/calypso-config'; | |
| import { Component, ReactNode } from 'react'; | |
| import { logToLogstash } from 'calypso/lib/logstash'; | |
| interface CrowdsignalPollErrorBoundaryProps { | |
| children: ReactNode; | |
| } | |
| class CrowdsignalPollErrorBoundary extends Component< CrowdsignalPollErrorBoundaryProps > { | |
| state = { error: null }; | |
| componentDidCatch( error: Error ) { | |
| this.setState( { error } ); | |
| logToLogstash( { | |
| feature: 'calypso_client', | |
| message: 'Reader Crowdsignal poll error', | |
| severity: config( 'env_id' ) === 'production' ? 'error' : 'debug', | |
| extra: { | |
| env: config( 'env_id' ), | |
| type: 'reader_crowdsignal_poll_error', | |
| message: String( error ), | |
| }, | |
| } ); | |
| } | |
| render() { | |
| if ( this.state.error ) { | |
| return null; | |
| } | |
| return this.props.children; | |
| } | |
| } | |
| export default CrowdsignalPollErrorBoundary; | |