Пример #1
0
        private string GetErrorTitle(BotErrorCodes errorCode)
        {
            switch (errorCode)
            {
            case BotErrorCodes.CourseNotFound:
                return(this.localizer.GetString("courseNotFoundErrorTitle").Value);

            case BotErrorCodes.CommandContextNotSupported:
                return(this.localizer.GetString("commandContextNotSupportedErrorTitle").Value);

            case BotErrorCodes.CommandNotSupported:
                return(this.localizer.GetString("commandNotSupportedErrorTitle").Value);

            case BotErrorCodes.ForbidenToSelectAnswer:
                return(this.localizer.GetString("forbiddenToSelectAnswerErrorTitle").Value);

            case BotErrorCodes.QuestionNotFound:
                return(this.localizer.GetString("questionNotFoundErrorTitle").Value);

            case BotErrorCodes.QuestionMarkedAsAnswered:
                return(this.localizer.GetString("questionMarkedAsAnsweredErrorTitle").Value);

            case BotErrorCodes.Unknown:
                return(this.localizer.GetString("unknownErrorTitle").Value);

            default:
                this.logger.LogWarning($"Add error message for ErrorCode: {errorCode}");
                return(this.localizer.GetString("unknownErrorTitle").Value);
            }
        }
Пример #2
0
 private MessagingExtensionActionResponse GetMessagingExtensionErrorResponse(BotErrorCodes errorCode)
 {
     return(new MessagingExtensionActionResponse()
     {
         Task = this.GetErrorMessageBoxResponse(errorCode),
     });
 }
Пример #3
0
        private TaskModuleContinueResponse GetErrorMessageBoxResponse(BotErrorCodes errorCode)
        {
            var title   = this.GetErrorTitle(errorCode);
            var message = this.GetErrorMessage(errorCode);

            return(new TaskModuleContinueResponse()
            {
                Value = new TaskModuleTaskInfo()
                {
                    Card = this.messageFactory.CreateErrorMessage(message),
                    Title = title,
                    Width = "small",
                },
            });
        }