private async Task TransformException(OwinContext context, ITransform transform, Exception ex) { string content = transform.GetContent(ex); context.Response.ContentType = "text/plain"; context.Response.StatusCode = (int) transform.StatusCode; context.Response.ReasonPhrase = transform.ReasonPhrase; context.Response.ContentLength = content.Length; await context.Response.WriteAsync(content); }