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

Commit

Permalink
Merge pull request #1080 from colestrode/dialog-errors
Browse files Browse the repository at this point in the history
tests if errors is an array in dialogError
  • Loading branch information
Ben Brown authored Oct 10, 2017
2 parents 01c5879 + c4d33fc commit 74fe927
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 74fe927

Please sign in to comment.