Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 2204 | Rev 2206 | Ir a la última revisión | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |

import React from 'react'
import { connect } from 'react-redux'

import { addNotification } from '@app/redux/notification/notification.actions'

class ErrorBoundary extends React.Component {
  componentDidCatch(error, errorInfo) {
    console.log('Error message', error.message)
    console.log('ErrorBoundary caught an error: ', error, errorInfo)
    this.props.addNotification({ style: 'danger', msg: error.message })
  }

  render() {
    return this.props.children
  }
}

export default connect(null, { addNotification })(ErrorBoundary)