Description
Version info
- intercom-node version: 2.9.1
- Node version: 6.11.0
Expected behavior
not to crash
Actual behavior
crashes our nodejs application entirely
Steps to reproduce
I don't know how to reproduce the bug but it seems to be incorrect error handling. Perhaps when the API returns some unexpected data? This happened at 2017-11-02 20:16 CET. But it does not happen any more.
Logs
TypeError: Cannot read property 'error' of undefined
1
at callback (/var/app/current/node_modules/intercom-client/dist/client.js line 221 col 29)
var hasErrors = data.error || data.body && data.body.type === 'error.list';
2
at Request._callback (/var/app/current/node_modules/intercom-client/dist/client.js line 137 col 13)
callbackHandler(resolver, r);
3
at self.callback (/var/app/current/node_modules/request/request.js line 186 col 22)
self._callback.apply(self, arguments)
4
at emitOne (events.js line 96 col 13)
5
at Request.emit (events.js line 188 col 7)
6
at Request.onRequestError (/var/app/current/node_modules/request/request.js line 878 col 8)
self.emit('error', error)
7
at emitOne (events.js line 96 col 13)
8
at ClientRequest.emit (events.js line 188 col 7)
9
at TLSSocket.socketErrorListener (_http_client.js line 309 col 9)
10
at emitOne (events.js line 96 col 13)
11
at TLSSocket.emit (events.js line 188 col 7)
12
at emitErrorNT (net.js line 1277 col 8)
13
at (/var/app/current/node_modules/async-listener/glue.js line 188 col 31)
var returned = original.apply(this, arguments);
14
at _combinedTickCallback (internal/process/next_tick.js line 80 col 11)
15
at process._tickDomainCallback (internal/process/next_tick.js line 128 col 9)
16
at process.fallback (/var/app/current/node_modules/async-listener/index.js line 539 col 15)
return fn.apply(this, args || arguments);