fix: don't forward undefined

This commit is contained in:
cha0s 2018-12-24 13:21:03 -06:00
parent 75f2e80507
commit f86c2ce89c

View File

@ -34,12 +34,14 @@ export class Dispatcher {
if (debugAction) {
debug(`dispatching ${JSON.stringify(debugAction, null, ' ')}`);
}
Promise.resolve(actions[action.type](action)).then((result) => {
const actionPromise = actions[action.type](action);
Promise.resolve(actionPromise).then((result) => {
if ('undefined' === typeof result) {
debug(`undefined result from ${action.type} not forwarded!`);
}
socket.write(pack(result));
else {
socket.write(pack(result));
}
socket.end();
}).catch((error) => { this.handleError(error); });
});