@@ -6,6 +6,7 @@ import React from 'react'
66import ReactDom from 'react-dom'
77
88import configuration from './configuration'
9+ import { getComponentDisplayName } from './internal/reactUtils'
910
1011let lastError = [ ]
1112
@@ -33,15 +34,24 @@ const inlineErrorStyle = {
3334
3435const listStyle = { }
3536
36- export const EmptyErrorPlaceholder = ( ) => (
37+ export const EmptyErrorPlaceholder = ( { component } ) => (
3738 < span style = { inlineErrorStyle } role = "img" aria-label = "Rect-Hot-Loader Error" >
38- ⚛️🔥🤕
39+ ⚛️🔥🤕 ({ component
40+ ? getComponentDisplayName ( component . constructor || component )
41+ : 'Unknown location' } )
3942 </ span >
4043)
4144
42- const mapError = ( { error, errorInfo } ) => (
45+ const mapError = ( { error, errorInfo, component } ) => (
4346 < div >
4447 < p style = { { color : 'red' } } >
48+ { component && (
49+ < span >
50+ ({ component
51+ ? getComponentDisplayName ( component . constructor || component )
52+ : 'Unknown location' } )
53+ </ span >
54+ ) }
4555 { error . toString ? error . toString ( ) : error . message || 'undefined error' }
4656 </ p >
4757 { errorInfo && errorInfo . componentStack ? (
@@ -129,7 +139,13 @@ export const clearExceptions = () => {
129139 }
130140}
131141
132- export const logException = ( error , errorInfo ) => {
133- lastError . push ( { error, errorInfo } )
142+ export const logException = ( error , errorInfo , component ) => {
143+ // do not suppress error
144+
145+ /* eslint-disable no-console */
146+ console . error ( error )
147+ /* eslint-enable */
148+
149+ lastError . push ( { error, errorInfo, component } )
134150 initErrorOverlay ( )
135151}
0 commit comments