Skip to content

Undefined error when using .get() #134

Description

@david-coxon

It seems the ErrorStackParser variable is undefined, throwing an error when required instead of generating a complete stacktrace when using the get method.

I'm not sure if the issue is my fault or not, some guidance would be appreciated.

Here's the..er..stacktrace of the error itself.

TypeError: Cannot read property 'parse' of undefined at Object.<anonymous> (http://localhost:3000/libs/stacktrace-js/stacktrace.js:79:51) 
at Object.StackTrace$$fromError [as fromError] (http://localhost:3000/libs/stacktrace-js/stacktrace.js:78:20) 
at Object.StackTrace$$get [as get] (http://localhost:3000/libs/stacktrace-js/stacktrace.js:63:33) 
at Object.processErrorCode 
...

And here's my code block that the issue originates from.

  StackTrace.get()
                    .then(function (stackframes) {
                        var stringifiedStack = stackframes.map(function (sf) {
                            return sf.toString();
                        }).join('\n');
                        Logger.getErrors().addMessage(errorMessage, stringifiedStack, "ErrorCode");
                    })
                    .catch(function (err) {
                        Logger.getErrors().addMessage(errorMessage, err.stack, "ErrorCode");
                    });

Activity

  1. eriwen commented on Oct 14, 2015

    @eriwen
    Member

    It looks like you may be using stacktrace.js without dependencies. I would recommend grabbing stacktrace.min.js from the Releases page unless you're getting stacktrace.js from bower or npm, in which case, please let us know.

  2. david-coxon commented on Oct 14, 2015

    @david-coxon
    Author

    There was an issue using wiredep via gulp, in which it would not inject the bower script reference correctly. I do have many other bower libraries injecting fine so it is unlikely to be an issue with my setup.

    As a result, I had to manually include the stacktrace reference.

    Having looked in my bower_components, I have 2 bower files, '.bower.json' and 'bower.json', neither list dependencies.

    There is a component.json file as well which does list the dependencies, but it seems that bower has failed to resolve them.

    I'm not too sure how bower works so can't offer any conclusions other than that.

    Hope this is useful.

  3. oliversalzburg commented on Oct 14, 2015

    @oliversalzburg
    Contributor

    Yeah, bower.json should list error-stack-parser as a dependency for this to work correctly. I'll send a PR tonight.

  4. eriwen commented on Oct 14, 2015

    @eriwen
    Member

    Wow, this is a rather glaring omission on our part.

    Very sorry about this, @dvdcxn. We'll get it fixed very soon.

    @oliversalzburg It looks like stacktrace-gps may have the same problem, and we may have to figure out how to handle the source-map dependency there since it's not registered in bower.

  5. oliversalzburg commented on Oct 14, 2015

    @oliversalzburg
    Contributor

    @eriwen We can set a git URL as the dependency. That should work fine. I'll play around until I got something working :)

    I might have to delay my pending PRs though. I'm still at work, working hard to push out the new major release of our product :P

  6. MikeSam commented on Oct 15, 2015

    @MikeSam

    +1

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions