Пример #1
0
        /// <summary>
        /// Handles the skill session ending.
        /// </summary>
        /// <param name="session">The Alexa session.</param>
        /// <returns>
        /// The <see cref="ResponseBody"/> to return from the skill.
        /// </returns>
        public SkillResponse OnSessionEnded(Session session)
        {
            TrackEvent("SessionEndedRequest", session);

            return(SkillResponseBuilder
                   .Tell(Strings.SessionEndResponse)
                   .Build());
        }
Пример #2
0
        /// <summary>
        /// Handles the skill being launched.
        /// </summary>
        /// <param name="session">The Alexa session.</param>
        /// <returns>
        /// The <see cref="ResponseBody"/> to return from the skill.
        /// </returns>
        public SkillResponse OnLaunch(Session session)
        {
            TrackEvent("LaunchRequest", session);

            return(SkillResponseBuilder
                   .Tell(Strings.LaunchResponse)
                   .ShouldNotEndSession()
                   .Build());
        }
Пример #3
0
        /// <summary>
        /// Handles an error.
        /// </summary>
        /// <param name="exception">The exception that occurred, if any.</param>
        /// <param name="session">The Alexa session.</param>
        /// <returns>
        /// The <see cref="ResponseBody"/> to return from the skill.
        /// </returns>
        public SkillResponse OnError(Exception exception, Session session)
        {
            Logger.LogError(exception, "Failed to handle request for session {SessionId}.", session.SessionId);

            TrackException(exception, session);

            return(SkillResponseBuilder
                   .Tell(Strings.InternalError)
                   .Build());
        }
Пример #4
0
        /// <summary>
        /// Handles a system error.
        /// </summary>
        /// <param name="error">The error that occurred.</param>
        /// <param name="session">The Alexa session.</param>
        /// <returns>
        /// The <see cref="ResponseBody"/> to return from the skill.
        /// </returns>
        public SkillResponse OnError(SystemExceptionRequest error, Session session)
        {
            Logger.LogError(
                "Failed to handle request for session {SessionId}. Error type {ErrorType} with cause {ErrorCause}: {ErrorMessage}",
                session.SessionId,
                error.Error.Type,
                error.ErrorCause?.requestId,
                error.Error.Message);

            return(SkillResponseBuilder
                   .Tell(Strings.InternalError)
                   .Build());
        }