From da5a1bb8dc558491a5320a5f497a32392cde622b Mon Sep 17 00:00:00 2001 From: Brian Broll Date: Wed, 7 Feb 2024 11:26:13 -0600 Subject: [PATCH] More logs in alexa service --- src/procedures/alexa/alexa.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/procedures/alexa/alexa.js b/src/procedures/alexa/alexa.js index e78d045e..0f183260 100644 --- a/src/procedures/alexa/alexa.js +++ b/src/procedures/alexa/alexa.js @@ -16,6 +16,7 @@ * @category ArtificialIntelligence * @category Devices */ +const logger = require("../utils/logger")("alexa"); const Alexa = {}; const AlexaSkill = require("./skill"); const GetStorage = require("./storage"); @@ -56,6 +57,7 @@ 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", { @@ -63,12 +65,23 @@ Alexa.createSkill = async function (configuration) { }), (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); }