Giter Site home page Giter Site logo

Comments (14)

vivekkrbajpai avatar vivekkrbajpai commented on August 23, 2024

Totally agreed the way it handles error is very bad.In some cases it crashes the entire application. With error message segmentation fault (core dump )

from aerospike-client-nodejs.

AlgoTrader avatar AlgoTrader commented on August 23, 2024

After dozens of core dumps with their C client and very poor support of scripting langs I am not considering AS as a serious production-ready solution. I am also not happy of how they communicate to developers, so, I put it off.

from aerospike-client-nodejs.

cstivers78 avatar cstivers78 commented on August 23, 2024

I agree it is idiomatic to not return the error on a success. We plan on changing it, but we have to weigh the impact on existing users, which I should have mentioned earlier, but I had let it slip. Apologies.

@vivekkrbajpai It is my first time hearing about core dumps associated with error objects. Can you file another ticket so we can follow up on that issue?

As for other issues, we work diligently to resolve them. We hope you are patient enough to wait for a resolution or assist us by indicating the severity of the issue with regards to your product, so we can prioritize accordingly.

from aerospike-client-nodejs.

vivekkrbajpai avatar vivekkrbajpai commented on August 23, 2024

Thanks for the response @cstivers78 👍 .I will create the new issue with my logs.

from aerospike-client-nodejs.

ctavan avatar ctavan commented on August 23, 2024

👍 from my side for passing null as a first callback argument if the operation was successful, this was confusing me right away when I started to work with the node driver.

But if you do the change, please stick to the node conventions and pass in null as a first argument if the operation was successful (as opposed to undefined which is mentioned in the title of this issue). It is common convention to pass null, not undefined, see e.g. http://fredkschott.com/post/2014/03/understanding-error-first-callbacks-in-node-js/

from aerospike-client-nodejs.

AlgoTrader avatar AlgoTrader commented on August 23, 2024

undefined and null for error are both valid. The difference is subtle.
callback() is success with undefined
callback(null) is also success but with null
They live in their own world, I do not think they care of node.js style and conventions. They just mechanically ported C client to node

from aerospike-client-nodejs.

ctavan avatar ctavan commented on August 23, 2024

@AlgoTrader a matter of taste I suppose. I think it is good node.js style to explicitly state the success case calling callback(null); ;)... But as I said, it's probably a matter of taste. Anything falsy should usually do since the canonical way of error handling is usually:

asyncStuff(function(err, result) {
  if (err) {
    console.error(err);
    return;
  }

  // do stuff with result
});

from aerospike-client-nodejs.

AlgoTrader avatar AlgoTrader commented on August 23, 2024

You are right, matter of taste. I use null but for third party code I also expect undefined

from aerospike-client-nodejs.

rschmukler avatar rschmukler commented on August 23, 2024

Just chiming in that this is very much an antipattern within node and that for things that assume falsy values (like libraries that convert callbacks to thunks/promises) it breaks them. +1 for changing it. No opinion on null vs undefined (null does feel more "node") but it should definitely not be an object on success.

from aerospike-client-nodejs.

EmilTholin avatar EmilTholin commented on August 23, 2024

+1 Aerospike is phenomenal, but this issue makes the Node driver very unpleasant to work with. It breaks the convention, and it makes it hard to wrap with bluebird. Maybe you could include a flag when initializing the client, if not changing it altogether?

var client = aerospike.client({
    hosts: [ { addr: '127.0.0.1', port: 3000 } ],
    standardNodeError: true // error === undefined upon success
});

from aerospike-client-nodejs.

eljefedelrodeodeljefe avatar eljefedelrodeodeljefe commented on August 23, 2024

This currently really stands in my way to really dive into aerospike 100% will a PR be quickly welcomed? @cstivers78

There is a similar issue with (the user incorrectly) passing, taht floats breaking the client or similar.

from aerospike-client-nodejs.

jhecking avatar jhecking commented on August 23, 2024

@eljefedelrodeodeljefe, a pull request would be welcome! As Chris had pointed out, this is a backwards incompatible change and can potentially affect existing application code. So we need to be mindful of this. Maybe you can open a PR and quickly describe the changes you plan to do? I'd be happy to work with you on this.

from aerospike-client-nodejs.

eljefedelrodeodeljefe avatar eljefedelrodeodeljefe commented on August 23, 2024

@jhecking moved this to #105

from aerospike-client-nodejs.

jhecking avatar jhecking commented on August 23, 2024

For v2 of the Aerospike Node.js client we have changed the semantics of the callbacks done by the client to follow the Node.js error-first callback semantics where the error argument is null if the operation was successful. v2 is now available as a pre-release in version 2.0.0-alpha.1 on npmjs.com.

Some additional resources:

from aerospike-client-nodejs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.