const { startReportingRuntimeErrors , reportBuildError , dismissBuildError : dismissBuildErrorInOverlay , dismissRuntimeErrors : dismissRuntimeErrorsInOverlay , } = require ( 'react-error-overlay' ) ; let currentBuildError = null ; let hasRuntimeError = false ; let hasStartedReportingRuntimeErrors = false ; function startReportingRuntimeErrorsIfNotStarted ( ) { if ( ! hasStartedReportingRuntimeErrors ) { startReportingRuntimeErrors ( { onError : ( ) => { } } ) ; hasStartedReportingRuntimeErrors = true ; } } const dismissBuildError = ( ) => { currentBuildError = null ; dismissBuildErrorInOverlay ( ) ; } ; const dismissRuntimeErrors = ( ) => { hasRuntimeError = false ; dismissRuntimeErrorsInOverlay ( ) ; } ; const handleBuildError = ( error ) => { currentBuildError = error ; if ( error . message ) { reportBuildError ( error . message ) ; } } ; param error const handleRuntimeError = ( error ) => { hasRuntimeError = true ; throw new Error ( error . message ) ; } ; export { startReportingRuntimeErrorsIfNotStarted , currentBuildError , hasRuntimeError , dismissBuildError , dismissRuntimeErrors , handleBuildError , handleRuntimeError , } ;