PlayNetwork / json-ipc-lib

An ES6 native Node library for creating and consuming a UNIX Domain Socket and messaging with JSON-RPC 2.0 for inter process communication.
7 stars 3 forks source link

Server methods that return false either synchronously or asynchronously are not handled correctly #5

Closed cmerchant closed 5 years ago

cmerchant commented 6 years ago

Calling a server method that resolves with a promise that returns a false or a synchronous method that returns false results in unexpected problems. The client does not get the expected false result and instead gets undefined or an unhandled exception. I have created a two unit tests in this project that show the issues. Basically the error we are seeing is,

1) Client #call should support asynchronous server methods returning boolean false: AssertionError: expected undefined to exist

Or in the synchronous case,

(node:3916) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 5): TypeError: result.then is not a function (node:3916) [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.

See branch falseFix with failing unit test for details.

Pull request submitted

brozeph commented 5 years ago

Resolved in PR #6 - closing as fixed