stacktracejs/stacktrace.js

not working with chrome? Cannot parse given Error object

embryologist opened this issue ยท 10 comments

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

Cannot parse given Error object
adding,

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

Error: from onerror at errback (PatientRegistration:1590) at anonymous

@eriwen, is this a new issue, I m using cdn lib

This error occurs if you throw a string. You have to do new Error("your string").

@rgfactory an error may be in a 3rd party library, or a programmer made a mistake. A library designed to handle errors shouldn't break in the face of a common error.

1-0-1 commented

Just started using this and I'm getting this error, too. I am getting it when passing back a Response from http in Angular 4.

I am closing this. the dev totally ignored it. I moved to angular and this project does not stop throwing weird errors left and right.

capaj commented

@embryologist how does closing the issue help?

@embryologist - I will open a separate issue if you keep this closed. Please re-open.

Re-opened. We will resolve this.

Has there been any progress on this issue? We now started getting it as well. This ticket has been open for almost 5 years.

This error was being thrown for me due to passing a String or Response to StackTrace.fromError. It'd be good from developer experience perspective if StackTrace handled things like this or raised a helpful error.