stacktrace.js icon indicating copy to clipboard operation
stacktrace.js copied to clipboard

not working with chrome? Cannot parse given Error object

Open embryologist opened this issue 8 years ago • 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

embryologist avatar Sep 03 '17 23:09 embryologist

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

embryologist avatar Sep 03 '17 23:09 embryologist

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

rgfactory avatar Oct 18 '17 15:10 rgfactory

@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.

ubershmekel avatar Nov 15 '17 18:11 ubershmekel

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.

1-0-1 avatar Nov 15 '17 19:11 1-0-1

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.

embryologist avatar Dec 20 '17 06:12 embryologist

@embryologist how does closing the issue help?

capaj avatar May 08 '19 09:05 capaj

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

ubershmekel avatar May 08 '19 20:05 ubershmekel

Re-opened. We will resolve this.

niftylettuce avatar Dec 05 '19 15:12 niftylettuce

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

mmarekbb avatar Mar 15 '22 16:03 mmarekbb

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.

zlawson-ut avatar May 07 '22 19:05 zlawson-ut