Skip to content
This repository was archived by the owner on Jun 23, 2020. It is now read-only.

Improve error handling, critical needs input #16

@riston

Description

@riston

There are some cases where the response is not handled correctly, this seems to be faulty on Desk side but also needs handling in library.

Also it would be good to expose the request timeout module option for longer requests like >3 seconds.

The error looks like this, the body is not containing the result object:

/app/node_modules/desk.js/lib/client.js:133
    if (response.statusCode > 299 && 'message' in body)
                                                  ^
TypeError: Cannot use 'in' operator to search for 'message' in undefined
    at Client.onResponse (/app/node_modules/desk.js/lib/client.js:133:51)
    at Request._callback (/app/node_modules/desk.js/node_modules/async/lib/async.js:597:23)
    at Request.self.callback (/app/node_modules/desk.js/node_modules/request/request.js:129:22)
    at emitTwo (events.js:87:13)
    at Request.emit (events.js:172:7)
    at Request.<anonymous> (/app/node_modules/desk.js/node_modules/request/request.js:873:14)
    at emitOne (events.js:82:20)
    at Request.emit (events.js:169:7)
    at IncomingMessage.<anonymous> (/app/node_modules/desk.js/node_modules/request/request.js:824:12)
    at emitNone (events.js:72:20)

Also made the PR for the error handling #15

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions