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

Commit

Permalink
tests if errors is an array in dialogError
Browse files Browse the repository at this point in the history
  • Loading branch information
colestrode committed Oct 9, 2017
1 parent 4b8e29c commit c4d33fc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/Slackbot_worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
});
Expand Down

0 comments on commit c4d33fc

Please sign in to comment.