While fetching events, after some time I got this error :
(node:11544) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'forEach' of undefined
at PATH_TO/node_modules/node-syncthing/lib/event-caller.js:49:18
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
(node:11544) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:11544) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Error is here :
|
req({ method: 'events', endpoint: false, attr: attr }).then(function (eventArr) { |
|
|
|
//Check for event count on first request iteration |
|
if (since != 0) { |
|
eventArr.forEach(function (e) { |
|
_this.emit(lowerCaseFirst(e.type), e.data); |
|
}); |
|
} |
I think that the request never returns, even with an error. Should we handle this case typeof eventArr === "undefined" by throwing an error, incrementing retries and bypassing event emitting/counting steps ?
While fetching events, after some time I got this error :
Error is here :
node-syncthing/lib/event-caller.js
Lines 43 to 50 in ef56646
I think that the request never returns, even with an error. Should we handle this case
typeof eventArr === "undefined"by throwing an error, incrementingretriesand bypassing event emitting/counting steps ?