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

Added error logging for say and spawn.run #691

Merged
merged 1 commit into from
Mar 9, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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