public ISkillResult Handle(Exception exception, IRequest request) { var context = (request as ContextRequest)?.Context; var rb = new ResponseBuilder(context); rb .Tell("Leider ist ein Fehler aufgetreten.") .WithCard(card => { card.WithSimpleCard(exception.GetType().ToString(), exception.StackTrace); }) .WithDisplay(display => { display .FromTemplate(BodyTemplateType.BodyTemplate1) .WithTitle(exception.GetType().ToString()) .WithPrimaryPlainText(exception.Message) .WithSecondaryPlainText(exception.StackTrace) ; }) ; // TODO Version = requestEnvelope.Version, // Build response var session = (request as SessionRequest)?.Session; var resultBuilder = new SkillResultBuilder(); var result = resultBuilder.Build(rb.Build(), session?.Attributes); return(new OkResult(result)); }
private async Task <string> ProcessRequestAsync(IRequest request) { Guard.ArgumentNotNull(request, nameof(request)); sessionManager.Initialize(request as SessionRequest); var handler = new RequestHandlerFactoryWrapper(); var response = await handler.Execute(serviceProvider, request); // TODO Version, // Build response var resultBuilder = new SkillResultBuilder(); var jsonResult = resultBuilder.Build(response, sessionManager.Session?.Attributes); return(Guard.ExceptionWhenNull(jsonResult)); }