Skip to content

syntax error (aka. simple errors) are not traced #20

Description

@msawired

Hello!

I started using stacktracejs on OpenProcessing, and realized that in cases where error is a simple error without error.stack (e.g. a syntax error), stacktracejs returns an empty trace array, although the exception itself actually includes the filename, linenumber, charnumber.

window.onerror = function (msg, url, lineNumber, columnNo, error) { //no error.trace, but stacktrace can use msg, url, lineNumber, columnNo to create a single element array. StackTrace.fromError(error) .then(function(stackArray){ //stackArray is empty }) .catch(function (err) { //doesnt come here either }); } }

proposed solution
if error.stack is not accessible, stacktrace can still return a single item array using msg, url, lineNumber, columnNo provided.

What do you think?

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions