Add better error handling for NodeJS client. Currently, there are a number of places where the client might fail, and no error will be provided to the user.