mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2024-11-10 19:56:54 +03:00
Avoid error-polyfill issues
Fix https://twitter.com/acemarke/status/1088131480197443584
This commit is contained in:
parent
7c3b78d312
commit
22dc9f259c
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "redux-devtools-instrument",
|
||||
"version": "1.9.4",
|
||||
"version": "1.9.5",
|
||||
"description": "Redux DevTools instrumentation",
|
||||
"main": "lib/instrument.js",
|
||||
"scripts": {
|
||||
|
|
|
@ -19,6 +19,17 @@ export const ActionTypes = {
|
|||
PAUSE_RECORDING: 'PAUSE_RECORDING'
|
||||
};
|
||||
|
||||
const isChrome = (
|
||||
typeof window === 'object' && (
|
||||
typeof window.chrome !== 'undefined' ||
|
||||
typeof window.process !== 'undefined' &&
|
||||
window.process.type === 'renderer'
|
||||
));
|
||||
|
||||
const isChromeOrNode = (
|
||||
isChrome || (typeof process !== 'undefined' && process.release.name === 'node')
|
||||
);
|
||||
|
||||
/**
|
||||
* Action creators to change the History state.
|
||||
*/
|
||||
|
@ -46,7 +57,7 @@ export const ActionCreators = {
|
|||
} else {
|
||||
const error = Error();
|
||||
let prevStackTraceLimit;
|
||||
if (Error.captureStackTrace) {
|
||||
if (Error.captureStackTrace && isChromeOrNode) { // avoid error-polyfill
|
||||
if (Error.stackTraceLimit < traceLimit) {
|
||||
prevStackTraceLimit = Error.stackTraceLimit;
|
||||
Error.stackTraceLimit = traceLimit;
|
||||
|
@ -130,12 +141,7 @@ function computeWithTryCatch(reducer, action, state) {
|
|||
nextState = reducer(state, action);
|
||||
} catch (err) {
|
||||
nextError = err.toString();
|
||||
if (
|
||||
typeof window === 'object' && (
|
||||
typeof window.chrome !== 'undefined' ||
|
||||
typeof window.process !== 'undefined' &&
|
||||
window.process.type === 'renderer'
|
||||
)) {
|
||||
if (isChrome) {
|
||||
// In Chrome, rethrowing provides better source map support
|
||||
setTimeout(() => { throw err; });
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue
Block a user