Skip to content

Commit

Permalink
More logs in alexa service
Browse files Browse the repository at this point in the history
  • Loading branch information
brollb committed Feb 7, 2024
1 parent bb7d16a commit da5a1bb
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/procedures/alexa/alexa.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* @category ArtificialIntelligence
* @category Devices
*/
const logger = require("../utils/logger")("alexa");
const Alexa = {};
const AlexaSkill = require("./skill");
const GetStorage = require("./storage");
Expand Down Expand Up @@ -56,19 +57,31 @@ Alexa.createSkill = async function (configuration) {
{ vendorId, manifest },
vendorId,
)).skillId;
logger.info(`Created skill with id: ${skillId}`);
await h.retryWhile(
() =>
smapiClient.setInteractionModelV1(skillId, stage, "en-US", {
interactionModel,
}),
(err) => err.statusCode === 404,
);
logger.info(`Set interaction model for ${skillId}`);
await smapiClient.updateAccountLinkingInfoV1(skillId, stage, {
accountLinkingRequest,
});
logger.info(`Updated account linking info for ${skillId}`);
} catch (err) {
if (skillId) {
await smapiClient.deleteSkillV1(skillId);
logger.info(`Error occurred. Cleaning up ${skillId}`);
await smapiClient.deleteSkillV1(skillId)
.catch((err) => {
// the error is likely that the skill doesn't exist but logging just in case
logger.info(
`Error occurred during cleanup (${skillId}): ${
h.clarifyError(err)
}`,
);
});
}
throw h.clarifyError(err);
}
Expand Down

0 comments on commit da5a1bb

Please sign in to comment.