src/app/legacy/containers/PageHandlers/withError/index.jsx

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
import React from 'react';
import ErrorPage from '#pages/ErrorPage/ErrorPage';

const WithError = Component => {
  const ErrorContainer = ({ error = null, status, ...props }) => {
    if (!error) return <Component {...props} status={status} />;

    return <ErrorPage errorCode={status || 500} />;
  };

  return ErrorContainer;
};

export default WithError;