Variable don't reported as undefined (how to replicate and screens)


(Daniele Scasciafratte) #1

A friend reached me and discovered that there is a bug in the console.
As you can see in the screens below (and trying the code example
), in the stacktrace Firefox doesn’t report that the variable is undefined instead Chrome report that.




(Nicolas Chevobbe) #2

Thanks Daniele.
The issue lies in this piece of code:

      if (result instanceof Error) {
        result.sagaStack = 'at ' + name + ' \n ' + (result.sagaStack || result.stack);
      }
      if (!task.cont) {
        log('error', 'uncaught', result.sagaStack || result.stack);
        if (result instanceof Error && onError) {
          onError(result);
        }
      }

The library is using Error.stack to print the error, which is not standard and behaves differently in every browser (Chrome does print the error message along the stack).

There was a similar error in another library that we fixed (https://github.com/apollographql/react-apollo/pull/1568).
I’ll file a bug (and create a PR maybe) on the library


(Nicolas Chevobbe) #3

Filed https://github.com/redux-saga/redux-saga/issues/1376 in redux-saga :slight_smile:


(Daniele Scasciafratte) #4

Thanks for the explanation!