question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

not working with IE11? Cannot parse given Error object

See original GitHub issue

In IE11 I get this error: Cannot parse given Error object

window.onerror = (message, file, line, column, errorObject) =>{
    StackTrace.fromError(errorObject).then(callback).catch(e => console.log(e));
}

the error that is triggered seems to be a security error that happens when a new WebSocket is created. SCRIPT5022: SecurityError

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
embryologistcommented, Sep 3, 2017

same exact story here

window.onerror = function(msg, file, line, col, error) {
  StackTrace.fromError(error).then(callback).catch(errback);
}
var errback = function(err) { console.log('here '+ err.message);
console.log(new Error("from onerror").stack);
};
var callback = function(stackframes) {
    var stringifiedStack = stackframes.map(function(sf) {
      return sf.toString();
    }).join('\n');  };

Cannot parse given Error object

Google chrome!

0reactions
StephaneSeyvozcommented, Jun 21, 2019

Hi,

I’m not using stacktracejs “as is”, just error-stack-parser, and had a “Cannot parse given Error object” issue with IE11 as well.

When an error object is created in IE it doesn’t contain the necessary “stack” field at all, an Error needs to have been thrown for it to be defined in the resulting exception.

let error = new Error("getStack");
console.log(error);
if (detectIE()) { // https://stackoverflow.com/a/21712356
    try {
        throw error;
    } catch (e) {
        error = e;
    }
}
console.log(error);
const stackFrames = ErrorStackParser.parse(error); // replace by StackTrace.fromError(error) ?

Console output:

[object Error]{description: "getStack", message: "getStack", name: "Error"}
[object Error]{description: "getStack", message: "getStack", name: "Error", stack: "Error: getS..."}

This example obviously creates an “in-place” stack trace and may not answer the WebSocket error from the original post but maybe others… And since this issue is the first result when looking for “IE11 Cannot parse given Error object” on Google, I thought this behaviour could be worth mentioning.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error in IE 11 browser - EXCEPTION: Object doesn't support ...
In my case, the webpage works fine in firefox and chrome browser but in IE v.11 it shows error as error comes in...
Read more >
Handling common JavaScript problems - MDN Web Docs
Now we'll look at common cross-browser JavaScript problems and how to fix them. This includes information on using browser dev tools to ...
Read more >
Browser Related Troubleshooting | Confluence
Drag and drop does not work in Internet Explorer 9 (IE9). ... Internal Server Error due to ParseException es-419 is not a Valid...
Read more >
Debug JavaScript in Internet Explorer 11 in 7 easy steps
The developer tools built into IE11 make developing and debugging code in ... In the app, you know the problem lies in the...
Read more >
PRB: XML Parser Cannot Parse UTF-7 Documents
To resolve this problem, save your XML documents as UTF-8, the preferred transfer encoding format for Unicode. MSXML 2.6 or later supports UTF-7...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found