Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Examples seem out of date with current execute() argument list #62

Open
zedrdave opened this issue Oct 29, 2016 · 0 comments
Open

Examples seem out of date with current execute() argument list #62

zedrdave opened this issue Oct 29, 2016 · 0 comments

Comments

@zedrdave
Copy link

After fixing the connection issue, examples still fail with this error:

TypeError: callback is not a function

Looking at the code for node-example.js, execute() is called with:

client.execute(script, function(err, res) {

However, the prototype for execute() is:

execute(script, bindings = {}, message = {}, ...args) {

Where the callback is either taken from args or from message (if message has type function).

I guess this could be fixed by adding an empty dict to the call in the example scripts (so that the callback becomes the 3rd argument) or, more elegantly, by adding a check for bindings as well as message:

   if (typeof message === 'function') {
      callback = message;
      message = {};
    }
    else if (typeof bindings === 'function') {
        callback = bindings;
        bindings = {};
    }

I'll be happy to submit a PR if that helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant