Skip to content

Undefined error when using .get() #134

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

Closed
david-coxon opened this issue Oct 13, 2015 · 6 comments
Closed

Undefined error when using .get() #134

david-coxon opened this issue Oct 13, 2015 · 6 comments

Comments

@david-coxon
Copy link

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");
                    });
@eriwen
Copy link
Member

eriwen commented Oct 14, 2015

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.

@david-coxon
Copy link
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.

@oliversalzburg
Copy link
Member

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

@eriwen
Copy link
Member

eriwen commented Oct 14, 2015

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.

@oliversalzburg
Copy link
Member

@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

@MikeSam
Copy link

MikeSam commented Oct 15, 2015

+1

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

4 participants