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

Fix Cannot read property 'statusCode' of undefined when updating #40

Merged
merged 10 commits into from
May 13, 2020

Conversation

ernestii
Copy link
Contributor

@ernestii ernestii commented Aug 15, 2019

Fix Cannot read property 'statusCode' of undefined when updating and there's no connection

Before:

$ node index.js update
Checking for updates...
No update available. You have the latest version: 1.4.1
------------------------------------------------------------------
Uncaught Error: TypeError: Cannot read property 'statusCode' of undefined
    at Request.request.get [as _callback] (/Users/ernest.iliiasov/logdna/logdna-cli/lib/utils.js:175:55)
    at self.callback (/Users/ernest.iliiasov/logdna/logdna-cli/node_modules/request/request.js:185:22)
    at Request.emit (events.js:189:13)
    at Request.onRequestError (/Users/ernest.iliiasov/logdna/logdna-cli/node_modules/request/request.js:881:8)
    at ClientRequest.emit (events.js:194:15)
    at TLSSocket.socketErrorListener (_http_client.js:392:9)
    at TLSSocket.emit (events.js:189:13)
    at emitErrorNT (internal/streams/destroy.js:82:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
    at process._tickCallback (internal/process/next_tick.js:63:19)
------------------------------------------------------------------

After:

$ node index.js update
Checking for updates...
Error [no response]: Error: getaddrinfo ENOTFOUND repo.logdna.com repo.logdna.com:443

Prevent calling callback twice

Before:

$ logdna update
Checking for updates...
No update available. You have the latest version: 1.4.1

After

$ logdna update
Checking for updates...
No update available. You have the latest version: 1.4.1
No update available. You have the latest version: 1.4.1

dchai76
dchai76 previously approved these changes Aug 15, 2019
Copy link

@dchai76 dchai76 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing.

lib/utils.js Outdated Show resolved Hide resolved
smusali
smusali previously approved these changes May 12, 2020
Copy link
Contributor

@smusali smusali left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for me, it looks good! can you also check for the final time and approve, @ydshah2?

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Some small changes.

lib/utils.js Show resolved Hide resolved
lib/utils.js Outdated Show resolved Hide resolved
lib/utils.js Outdated Show resolved Hide resolved
@smusali
Copy link
Contributor

smusali commented May 13, 2020

Done, @ydshah2!

@smusali smusali requested a review from a user May 13, 2020 17:18
@ghost ghost changed the base branch from master to yash_jsonFix May 13, 2020 17:39
@ghost ghost changed the base branch from yash_jsonFix to master May 13, 2020 17:39
Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great. +1!

@smusali smusali merged commit 8980e6c into master May 13, 2020
@smusali smusali deleted the fix-statuscode-error branch May 13, 2020 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants