Skip to content
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

Response object undefined #46

Closed
chrisnewtn opened this issue Oct 13, 2012 · 2 comments
Closed

Response object undefined #46

chrisnewtn opened this issue Oct 13, 2012 · 2 comments
Labels

Comments

@chrisnewtn
Copy link
Member

Just got this error trying to graph http://premasagar.com/:

/home/cnewton/Development/l4rp/elsewhere/lib/scraper.js:58
            logger.warn('http error: '  + response.statusCode 
                                                  ^
TypeError: Cannot read property 'statusCode' of undefined
    at Request._callback (/home/cnewton/Development/l4rp/elsewhere/lib/scraper.js:58:51)
    at Request.init.self.callback (/home/cnewton/Development/l4rp/elsewhere/node_modules/request/main.js:120:22)
    at Request.EventEmitter.emit (events.js:88:17)
    at ClientRequest.Request.init.self.clientErrorHandler (/home/cnewton/Development/l4rp/elsewhere/node_modules/request/main.js:222:10)
    at ClientRequest.EventEmitter.emit (events.js:88:17)
    at CleartextStream.socketCloseListener (http.js:1314:9)
    at CleartextStream.EventEmitter.emit (events.js:115:20)
    at SecurePair.destroy (tls.js:907:22)
    at process.startup.processNextTick.process._tickCallback (node.js:244:9)

Seems that in certain situations the response object comes back undefined. I'm going to try to replicate/fix it after food, but otherwise I'm loving the changes so far.

@premasagar
Copy link
Member

Is this the same as #45?

@glennjones
Copy link
Member

Corrected this problem by using the node.js url parser to test for errors in the passed url string. Also changed the code around the http request so that it test to see if property 'statusCode' is defined before trying use it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants