From c4d33fce642a10ec4f59f5582009089941d4fc78 Mon Sep 17 00:00:00 2001 From: Cole Furfaro-Strode Date: Mon, 9 Oct 2017 15:24:45 -0400 Subject: [PATCH] tests if errors is an array in dialogError --- lib/Slackbot_worker.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 });