Skip to content

SyntaxError cannot be parsed #197

@nickasd

Description

@nickasd

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions