Skip to content

Commit

Permalink
Improve error handling on publish.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredhanson committed Mar 29, 2014
1 parent d580300 commit 53d7e45
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/crane-amqp/broker.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,17 +154,17 @@ Broker.prototype.enqueue = function(topic, msg, options, cb) {
topic = topic.replace(/\//g, '.');

options.deliveryMode = (options.deliveryMode === undefined) ? PERSISTENT_MODE : options.deliveryMode;
// TODO: This option appears to have no effect. Why?
// TODO: This option appears to have no effect. Investigate why.
//options.mandatory = (options.mandatory === undefined) ? true : options.mandatory;

if (this._exchange.options && this._exchange.options.confirm) {
debug('publish %s (confirm)', topic);
this._exchange.publish(topic, msg, options, function(hadError) {
var err;
this._exchange.publish(topic, msg, options, function(hadError, err) {
if (hadError) {
err = new Error('Failed to publish message to topic "' + topic + '"');
err = err || new Error('Failed to publish message to topic "' + topic + '"');
return cb(err);
}
return cb(err);
return cb();
});
} else {
debug('publish %s', topic);
Expand Down

0 comments on commit 53d7e45

Please sign in to comment.