@@ -19,6 +19,17 @@ export const ActionTypes = {
19
19
PAUSE_RECORDING : 'PAUSE_RECORDING'
20
20
} ;
21
21
22
+ const isChrome = (
23
+ typeof window === 'object' && (
24
+ typeof window . chrome !== 'undefined' ||
25
+ typeof window . process !== 'undefined' &&
26
+ window . process . type === 'renderer'
27
+ ) ) ;
28
+
29
+ const isChromeOrNode = (
30
+ isChrome || ( typeof process !== 'undefined' && process . release . name === 'node' )
31
+ ) ;
32
+
22
33
/**
23
34
* Action creators to change the History state.
24
35
*/
@@ -46,7 +57,7 @@ export const ActionCreators = {
46
57
} else {
47
58
const error = Error ( ) ;
48
59
let prevStackTraceLimit ;
49
- if ( Error . captureStackTrace ) {
60
+ if ( Error . captureStackTrace && isChromeOrNode ) { // avoid error-polyfill
50
61
if ( Error . stackTraceLimit < traceLimit ) {
51
62
prevStackTraceLimit = Error . stackTraceLimit ;
52
63
Error . stackTraceLimit = traceLimit ;
@@ -130,12 +141,7 @@ function computeWithTryCatch(reducer, action, state) {
130
141
nextState = reducer ( state , action ) ;
131
142
} catch ( err ) {
132
143
nextError = err . toString ( ) ;
133
- if (
134
- typeof window === 'object' && (
135
- typeof window . chrome !== 'undefined' ||
136
- typeof window . process !== 'undefined' &&
137
- window . process . type === 'renderer'
138
- ) ) {
144
+ if ( isChrome ) {
139
145
// In Chrome, rethrowing provides better source map support
140
146
setTimeout ( ( ) => { throw err ; } ) ;
141
147
} else {
0 commit comments