NodeJS best practices: Errors for flow control?
问题 In Node.js, should I use errors for flow control, or should I use them more like exceptions? I'm writing an authentication controller and some unit tests in Sails.js, and currently, my registration method checks to see if a user with the same username exists. If a user already exists with the username, my model method calls its callback arguments with a new Error object, like so: Model: exists: function (options, cb) { User.findOne({ where: { username: typeof options === 'Object' && options