Skip to content

Better error in case of no connection #37

@Moire9

Description

@Moire9

I'll copy from an issue I mistakenly made on a project that uses yggdrasil.

My parents have my internet set to automatically turn off at 21:00. However, this is not what you think. Instead of it turning off, instead, all requests are intercepted and sent to a random xfinity 404 page, essentially blocking communication between client and server. However, this causes an error in node-at yggdrasil.

/mnt/d/Users/SirNapkin1334/Desktop/node-autotip-mod/node_modules/yggdrasil/lib/utils.js:23
    if (resp.body.length === 0) {
             ^

TypeError: Cannot read property 'body' of null
    at /mnt/d/Users/SirNapkin1334/Desktop/node-autotip-mod/node_modules/yggdrasil/lib/utils.js:23:14
    at ClientRequest.<anonymous> (/mnt/d/Users/SirNapkin1334/Desktop/node-autotip-mod/node_modules/phin/lib/phin.compiled.js:1:2551)
    at ClientRequest.emit (events.js:198:13)
    at TLSSocket.socketErrorListener (_http_client.js:401:9)
    at TLSSocket.emit (events.js:198:13)
    at emitErrorNT (internal/streams/destroy.js:91:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
    at process._tickCallback (internal/process/next_tick.js:63:19)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-autotip@2.1.3 start: `node index`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-autotip@2.1.3 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/sirnapkin1334/.npm/_logs/2020-05-05T04_21_00_075Z-debug.log

It seems, that when the internet connection is shut off, that the response becomes null, however, since this was never expected, there are no checks for this, therefore it attempts to retrieve data it cannot get.

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