不要怂,就是干,撸起袖子干!

Commit ff755e29 by Jan Aagaard Meier

Added docs for emitter.catch and changed the wording for the save docs a bit

1 parent 1aa973f1
...@@ -390,12 +390,12 @@ module.exports = (function() { ...@@ -390,12 +390,12 @@ module.exports = (function() {
}; };
/** /**
* Persist this instance to the database. * Validate this instance, and if the validation passes, persist it to the database.
* *
* On success, the callback will be called with this instance. On validation error, the callback will be called with an Error instance. * On success, the callback will be called with this instance. On validation error, the callback will be called with an instance of `Sequelize.ValidationError`.
* This error will have a property for each of the fields for which validation failed, with the error message for that field. * This error will have a property for each of the fields for which validation failed, with the error message for that field.
* *
* @param {Array} [fields] An optional array of strings, representing database columns. If fields is provided, only those columns will be saved. * @param {Array} [fields] An optional array of strings, representing database columns. If fields is provided, only those columns will be validation and saved.
* @param {Object} [options] * @param {Object} [options]
* @param {Object} [options.fields] An alternative way of setting which fields should be persisted * @param {Object} [options.fields] An alternative way of setting which fields should be persisted
* @param {Transaction} [options.transaction] * @param {Transaction} [options.transaction]
......
...@@ -253,6 +253,12 @@ module.exports = (function() { ...@@ -253,6 +253,12 @@ module.exports = (function() {
}).spread(onFulfilled, onRejected) }).spread(onFulfilled, onRejected)
} }
/**
* Shorthand for `then(null, onRejected)`
*
* @param {Function} onRejected
* @return {Bluebird.Promise}
*/
CustomEventEmitter.prototype.catch = function(onRejected) { CustomEventEmitter.prototype.catch = function(onRejected) {
return this.then(null, onRejected) return this.then(null, onRejected)
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!