Open Bug 1476666 Opened 4 years ago Updated 4 years ago

Confusing/unhelpful error message in Console

Categories

(DevTools :: Console, defect, P2)

defect

Tracking

(Not tracked)

People

(Reporter: janx, Unassigned)

References

Details

Currently, when I navigate to https://firefox-code-coverage.herokuapp.com/#/ I see the following error in the devtools console:

    TypeError: r is undefined [learn more]              coverage.js:201:6

There is no stack trace, and the file location link takes me to this line:

    webpack:///src/utils/coverage.js
    201|  if (summary.pending === 0) {

There is no `r` variable in the entire file.

As a comparison, Chrome's devtools console shows this error message instead:

    Uncaught (in promise) TypeError: Cannot read property 'pending' of undefined
So there are 3 issues there:
- The message could be better (like chrome one), which is what Bug 1259822 is about
- We reference `r`, which is probably the name of the webpack'd variable. It would be nice to be able to retrieve the original variable name
- There is no stacktrace

Jan, I can't reproduce the issue anymore. Is it me or was it fixed ?
Would you have a link where I can reproduce ? thanks !
Flags: needinfo?(janx)
Priority: -- → P2
See Also: → 1259822
The error still reproduces for me in Nightly, but it takes a while (I counted 21 seconds, you have to wait first for initial data to load, then for some additional polling to complete).

It would be nice to extract/reduce the problematic code, or to create a reproducing test case, but I'm not sure how to do either.
Flags: needinfo?(janx) → needinfo?(nchevobbe)
Thanks Jan, I do see the message as well when waiting for a bit.
For future reference, here's what we get from the server: 

```json
{
  "from": "server1.conn3.child1/consoleActor2",
  "type": "pageError",
  "pageError": {
    "errorMessage": "TypeError: r is undefined",
    "errorMessageName": "JSMSG_UNEXPECTED_TYPE",
    "exceptionDocURL": "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Errors/Unexpected_type?utm_source=mozilla&utm_medium=firefox-console-errors&utm_campaign=default",
    "sourceName": "https://firefox-code-coverage.herokuapp.com/index.28f1b6e814e3c9950f13.js",
    "lineText": "",
    "lineNumber": 58,
    "columnNumber": 49548,
    "category": "content javascript",
    "timeStamp": 1532094691242,
    "warning": false,
    "error": false,
    "exception": true,
    "strict": false,
    "info": false,
    "private": false,
    "stacktrace": null,
    "notes": null
  }
}
```

and indeed there's no stacktraces sent. I'll dig deeper to see why.
Flags: needinfo?(nchevobbe)
I do reproduce the no stack issue for uncaught promise rejection: 

data:text/html,<meta charset=utf8><script>
  function a () {b()}
  function b() {c();}
  function c() {
    new Promise(function(resolve,reject){
      let x = r.pending;
  })}
  a();
</script>
You need to log in before you can comment on or make changes to this bug.