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

bot.dialogError does not accept array of error messages #1079

Closed
colestrode opened this issue Oct 9, 2017 · 0 comments
Closed

bot.dialogError does not accept array of error messages #1079

colestrode opened this issue Oct 9, 2017 · 0 comments

Comments

@colestrode
Copy link
Contributor

When building a Slack app with a dialog using Botkit version 0.6.3, I get a generic error in Slack whenever I submit a set of errors as an array. Slack displays "We had some trouble connecting. Try again?" as an error in the dialog instead of inline error messages.

I see no errors in my console. I've seen the same issue with a single error in the array. A single error object produces the correct inline error in the dialog. According to the docs, I should be able to pass an array of errors.

Example code:

controller.on('slash_command', (bot, message) => {

      if (message.command !== '/testing') {
        return true;
      }

      const dialog = bot.createDialog('Schedule a Message', 'callback_id', 'Schedule')
        .addText('Text','text','some text')
        .addText('Text','text2','more text');
      
      bot.replyWithDialog(message, dialog.asObject());
    });

    controller.middleware.receive.use((bot, message, next) => {
      if ((message.type === 'dialog_submission' && message.callback_id === 'callback_id')) {
        // error on every submission for testing
        return bot.dialogError([{
          "name": "text",
          "error": "Some error message"
        }, {
          name: "text2",
          error: "another error message"
        }]);
      }

      next();
    });
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants