From 2edd094d45155678a344e18c1871ce705715eed6 Mon Sep 17 00:00:00 2001 From: Alec Lazarescu Date: Sun, 5 Mar 2017 08:01:00 -0500 Subject: [PATCH] Added error logging for say and spawn.run --- lib/CoreBot.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/lib/CoreBot.js b/lib/CoreBot.js index 623dd5888..dd22cdd8e 100755 --- a/lib/CoreBot.js +++ b/lib/CoreBot.js @@ -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;