Skip to content
This repository has been archived by the owner on Dec 4, 2018. It is now read-only.

Cannot read property 'length' of undefined ? #78

Closed
cteyton opened this issue Jun 7, 2016 · 2 comments
Closed

Cannot read property 'length' of undefined ? #78

cteyton opened this issue Jun 7, 2016 · 2 comments

Comments

@cteyton
Copy link

cteyton commented Jun 7, 2016

Hi there,

I have the following code snippet in my server.js file

64. bugsnag.register("MY_KEY", {
65.   sendCode: true,
66.    onUncaughtError: function(err) {
67.        bugsnag.notify(new Error(err), {
68.              errorName: "BadError"
69.        });
70.    }
71. });

I have an error generated by bugsnag :

/home/themis/web/dist/server/server.js:68bugsnag.register.onUncaughtError   
/home/themis/web/dist/node_modules/bugsnag/lib/bugsnag.js:22none    
/home/themis/web/dist/node_modules/bugsnag/lib/notification.js:177_callback 
/home/themis/web/dist/node_modules/bugsnag/node_modules/request/request.js:200self.callback 
events.js:87emitTwo 
events.js:172emit   
/home/themis/web/dist/node_modules/bugsnag/node_modules/request/request.js:1067none 
events.js:82emitOne 
events.js:169emit   
/home/themis/web/dist/node_modules/bugsnag/node_modules/request/request.js:988none  
events.js:72emitNone    
events.js:166emit   
_stream_readable.js:905endReadableNT    
node.js:441nextTickCallbackWith2Args    
node.js:396_tickDomainCallback

Do you have an idea of where does it come from ?

Thanks.

@jmshal
Copy link
Contributor

jmshal commented Jul 4, 2016

Have you tried not wrapping err when passing it to bugsnag.notify? The err argument should already be an Error object.

bugsnag.register("MY_KEY", {
  sendCode: true,
  onUncaughtError: function(err) {
    bugsnag.notify(err, {
      errorName: "BadError"
    });
  }
});

@cteyton
Copy link
Author

cteyton commented Jul 6, 2016

thanks 👍

@cteyton cteyton closed this as completed Jul 6, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants