Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SyntaxError cannot be parsed #197

Open
nickasd opened this issue Aug 24, 2017 · 0 comments
Open

SyntaxError cannot be parsed #197

nickasd opened this issue Aug 24, 2017 · 0 comments

Comments

@nickasd
Copy link

nickasd commented Aug 24, 2017

I'm currently using the following code to catch all kind of errors.

window.onerror = (message, filename, lineno, colno, error) => {
    StackTrace.fromError(error).then((stack) => {
        console.log(stack);
    }).catch((error) => {
        console.log(error);
    });
};

There seems to be a problem though with SyntaxErrors (e.g. one line in my script contains some random characters). In that case, I get different behavior in different browsers.
In Chrome 60, I get this stack trace: [{fileName: "SyntaxError: Unexpected identifier", source: "SyntaxError: Unexpected identifier"}]. In Safari 10.1.2, this error is logged Error: Cannot parse given Error object. Note that in both browsers the message, filename, lineno, colno arguments have meaningful values.
I'm using stacktrace-js 2.0.0 on macOS 10.12.6. Thanks in advance for any help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant