/** * @flow * @file withErrorHandling higher order component * @author Box */ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; import ErrorMask from '../../components/error-mask/ErrorMask'; import InlineError from '../../components/inline-error/InlineError'; import SidebarSection from './SidebarSection'; import type { Errors } from '../common/flowTypes'; type Props = { errorCode?: string, } & Errors; const withErrorHandling = (WrappedComponent: React.ComponentType) => ({ maskError, inlineError, errorCode, ...rest }: Props) => { if (maskError) { return ( } errorSubHeader={ maskError.errorSubHeader ? : undefined } /> ); } if (inlineError) { return ( <> }> ); } return ; }; export default withErrorHandling;