Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #691 from alecl/master
Browse files Browse the repository at this point in the history
Added error logging for say and spawn.run
  • Loading branch information
Ben Brown authored Mar 9, 2017
2 parents c20bf9d + 2edd094 commit 94bbe03
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions lib/CoreBot.js
Original file line number Diff line number Diff line change
Expand Up @@ -1028,15 +1028,21 @@ function Botkit(configuration) {
// mutate the worker so that we can call middleware
worker.say = function(message, cb) {
botkit.middleware.send.run(worker, message, function(err, worker, message) {
worker.send(message, cb);
if (err) {
botkit.log('Error in worker.say: ' + err);
} else {
worker.send(message, cb);
}
});
};
botkit.middleware.spawn.run(worker, function(err, worker) {
if (err) {
botkit.log('Error in middlware.spawn.run: ' + err);
} else {
botkit.trigger('spawned', [worker]);

botkit.trigger('spawned', [worker]);

if (cb) { cb(worker); }

if (cb) { cb(worker); }
}
});

return worker;
Expand Down

0 comments on commit 94bbe03

Please sign in to comment.