diff --git a/lib/Slackbot_worker.js b/lib/Slackbot_worker.js index ba8da8e0b..73989845c 100755 --- a/lib/Slackbot_worker.js +++ b/lib/Slackbot_worker.js @@ -625,9 +625,14 @@ module.exports = function(botkit, config) { }; bot.dialogError = function(errors) { - if (typeof(errors) === 'object') { + if (!errors) { + errors = []; + } + + if (Object.prototype.toString.call(errors) !== '[object Array]') { errors = [errors]; } + bot.res.json({ errors: errors });