import config from '@automattic/calypso-config'; import { Card } from '@automattic/components'; import { localize } from 'i18n-calypso'; import { PureComponent } from 'react'; class PostUnavailable extends PureComponent { render() { const error = this.props.post.error; if ( ! error ) { return null; } if ( error.status === 404 || error.error === 404 ) { // don't render a card for 404s. These are posts that we once had but were deleted. return null; } const message = error.message || this.props.translate( 'An error occurred loading this post.' ); /* eslint-disable wpcalypso/jsx-classname-namespace */ return (

Oops!

{ error.status ? `${ error.status }: ` : null } { message }

{ config.isEnabled( 'reader/full-errors' ) ? (
{ JSON.stringify( this.props.post, null, '  ' ) }
) : null }
); /* eslint-enable wpcalypso/jsx-classname-namespace */ } } export default localize( PostUnavailable );