用户响应被切断并抛出意外错误。如何获取发生的错误信息

User response is being cutoff and throwing an Unexpected Error. How to get the error message that happened

我正在使用 JOVO 开发一项技能,该技能会记录用户的笔记并保存在数据库中。工作流运行正常,但当我说一些数据时,数据被切断,其中一部分被保存在数据库中,但会话似乎仍然存在。

当我试图再次说些什么时,Alexa 说 意外错误。这只是为了一个意图而发生的。它有一个插槽,类型为 AMAZON.SearchQuery.

我想知道发生的确切错误并将其发送到我的电子邮件地址以便更好地理解。我该怎么做?

根据这篇文章,我可以自定义错误。但我想知道发生错误的确切类型,并在我的电子邮件中获取完整的错误消息。我该怎么做?

我检查了我的数据库字段长度,足以存储长文本。被保存的部分远不及字段长度。它要低得多。

但是,当我从 Alexa 测试控制台进行测试时,这并没有发生。从这里开始,即使是 500 个字符的长文本也可以很好地保存在数据库中。我正在为这个广告位使用 AMAZON.SearchQuery。 Alexa 对作为插槽值传递的字符长度有限制吗?

我找不到问题所在。 Google也没办法!

更新

意向代码:

async NotesBuilderIntent() {
    if (this.$inputs.note.value === undefined) {
      this.ask("what do you want me to know?");
    } else {
      if (this.$session.$data.agent_code === undefined) {
        /**
         * This client has landed directly on the intent
         * let's retrieve his info based in Amazon access token
         * and create required session values.
         */
        if (!this.$request.getAccessToken()) {
          return this.tell(
            "Oops! Looks like you have either disabled or not enabled the skill yet. Please link your account by going to the Alexa app or companion app to proceed. thank you!"
          );
        } else {
          const token = this.$request.getAccessToken();
          //Retrieve user data using access_token.
          const profile = await custom.getUserAmazonProfile(token);
          // Extract email and amazon profile_id
          const profile_id = profile.user_id;
          const profile_email = profile.email;
          const profile_name = profile.name;
          const objUser = await custom.validate_account(
            profile_id,
            profile_email
          );
          const status_code = parseInt(objUser.status_code);
          if (status_code === 100) {
            this.$session.$data.agent_code = objUser.client.agent_code;
            this.$session.$data.account_code = objUser.client.account_code;
          } else {
            const user = await custom.skillTestMode(
              profile_email,
              profile_name
            );
            const mode_current = user.current_mode;
            if (mode_current === "D") {
              this.$session.$data.agent_code = user.client.agent_code;
              this.$session.$data.account_code = user.client.account_code;
            } else {
              return this.tell(
                "sorry! looks like you are not authorized to use this skill. please contact your account manager."
              );
            }
          }
        }
      }
      /**
       * We already have the client info based on
       * access token and built required session values
       * to proceed.
       */
      const agent_note = this.$inputs.note.value;
      const agent_code = this.$session.$data.agent_code;
      const account_code = this.$session.$data.account_code;
      if (
        agent_note === "stop" ||
        agent_note === "cancel" ||
        agent_note === "later" ||
        agent_note === "maybe later" ||
        agent_note === "not now" ||
        agent_note === "nothing" ||
        agent_note === "no"
      ) {
        return this.toIntent("StopIntent");
      } else {
        const result = await custom.saveAgentNote(
          agent_code,
          account_code,
          agent_note
        );
        const output = result.speech;
        this.ask(`${output}`);
      }
    }
  }

saveAgentNote 函数:

saveAgentNote: async (agent_code, account_code, agent_note) => {
    let data = {};
    await rp({
      url: baseURI,
      headers: { "Content-Type": "application/json" },
      qs: {
        action: actions.addNote,
        code: agent_code,
        account_code: account_code,
        note: agent_note
      },
      method: "POST"
    })
      .then(body => {
        data = JSON.parse(body);
      })
      .catch(error => {
        console.log(error);
      });

    return data;
  }

在分析您的代码以找出导致会话保持活动状态的原因后,它似乎在下一个代码片段中:

const result = await custom.saveAgentNote(
          agent_code,
          account_code,
          agent_note
        );
        const output = result.speech;
        this.ask(`${output}`);

this.ask(`${output}`); 您必须将其替换为 this.tell(`${output}`);

有关它的更多信息,您可以查看下一个 link:
https://www.jovo.tech/docs/output