private async Task SingleErrorHandler(HttpRequest request, HttpResponse response, RouteData data) { var executor = new SingleError.Executor(); var result = executor.Operation(); if (result.Succeeded) { await response.WriteAsync("Operation succeeded"); } else { await response.WriteAsync(result.ErrorMessage); } }
private async Task SingleErrorHandler(HttpRequest request, HttpResponse response, RouteData data) { // Create an instance of the class that contains the operation var executor = new SingleError.Executor(); // Execute the operation and handle its result var result = executor.Operation(); if (result.Succeeded) { // Handle the success await response.WriteAsync("Operation succeeded"); } else { // Handle the failure await response.WriteAsync(result.ErrorMessage); } }