public override async Task OnExceptionAsync(ExceptionContext context) { var exception = context.Exception; var result = new ContentResult(); if (exception is ExceptionBase) { result.StatusCode = (int)HttpStatusCode.BadRequest; result.Content = exception.Message; result.ContentType = "text/plain"; logger.LogWarning(exception); await instrumentationService.PostWarningAsync(exception.ToString()); } else if (exception is ModuleConfigurationException) { result.StatusCode = (int)HttpStatusCode.InternalServerError; result.Content = exception.Message; result.ContentType = "text/plain"; logger.LogWarning(exception); } else { result.StatusCode = (int)HttpStatusCode.InternalServerError; result.Content = "An error occured while processing your request"; result.ContentType = "text/plain"; logger.LogError(exception); await instrumentationService.PostExceptionAsync(exception.ToString()); } context.Result = result; }