Skip to content

Commit

Permalink
Merge pull request #219 from NetsBlox/alexa-logging
Browse files Browse the repository at this point in the history
More logs in alexa service
  • Loading branch information
brollb authored Feb 7, 2024
2 parents bb7d16a + da5a1bb commit 45205bf
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 45205bf

Please sign in to comment.