Ответ пользователя прерывается и выдает непредвиденную ошибку. Как получить сообщение об ошибке - PullRequest
0 голосов
/ 16 июня 2020

Я развиваю навык, используя JOVO, который делает заметки от пользователей и сохраняет их в базе данных. Рабочий процесс работает нормально, но когда я что-то говорю, данные обрезаются, и часть их сохраняется в базе данных, но сеанс, кажется, еще жив.

Когда я пытаюсь что-то сказать И снова Алекса говорит: Неожиданная ошибка . Это происходит только с одним намерением. Он имеет один слот и тип 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;
  }
...