GitHub PullRequestReviewCommentEvent at 2014-10-10 17:42:40
Repository: Diagnostics
Actor: PinpointTownes
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/aspnet/Diagnostics/pulls/comments/18719591","id":18719591,"diff_hunk":"@@ -0,0 +1,82 @@\n+﻿// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.\n+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\n+\n+using System;\n+using System.Threading.Tasks;\n+using Microsoft.AspNet.Builder;\n+using Microsoft.AspNet.Http;\n+using Microsoft.Framework.Logging;\n+\n+namespace Microsoft.AspNet.Diagnostics\n+{\n+    public class ErrorHandlerMiddleware\n+    {\n+        private readonly RequestDelegate _next;\n+        private readonly ErrorHandlerOptions _options;\n+        private readonly ILogger _logger;\n+\n+        public ErrorHandlerMiddleware(RequestDelegate next, ILoggerFactory loggerFactory, ErrorHandlerOptions options)\n+        {\n+            _next = next;\n+            _options = options;\n+            _logger = loggerFactory.Create<ErrorHandlerMiddleware>();\n+            if (_options.ErrorPipeline == null)\n+            {\n+                _options.ErrorPipeline = _next;\n+            }\n+        }\n+\n+        public async Task Invoke(HttpContext context)\n+        {\n+            var responseStarted = false;\n+            try\n+            {\n+                context.Response.OnSendingHeaders(state => responseStarted = true, null);","path":"src/Microsoft.AspNet.Diagnostics/ErrorHandlerMiddleware.cs","position":34,"original_position":34,"commit_id":"dae8ff5022cf62b256970523cf0db1506ebba421","original_commit_id":"f273cbd64b48b42bbd22dc6ba3d8a3b37f86ca06","user":{"login":"PinpointTownes","id":6998306,"avatar_url":"https://avatars.githubusercontent.com/u/6998306?v=2","gravatar_id":"","url":"https://api.github.com/users/PinpointTownes","html_url":"https://github.com/PinpointTownes","followers_url":"https://api.github.com/users/PinpointTownes/followers","following_url":"https://api.github.com/users/PinpointTownes/following{/other_user}","gists_url":"https://api.github.com/users/PinpointTownes/gists{/gist_id}","starred_url":"https://api.github.com/users/PinpointTownes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PinpointTownes/subscriptions","organizations_url":"https://api.github.com/users/PinpointTownes/orgs","repos_url":"https://api.github.com/users/PinpointTownes/repos","events_url":"https://api.github.com/users/PinpointTownes/events{/privacy}","received_events_url":"https://api.github.com/users/PinpointTownes/received_events","type":"User","site_admin":false},"body":"Any chance we could get a more global `HeadersWritten` directly in `HttpResponse`? :smile_cat: ","created_at":"2014-10-10T17:42:40Z","updated_at":"2014-10-10T17:42:40Z","html_url":"https://github.com/aspnet/Diagnostics/pull/39#discussion_r18719591","pull_request_url":"https://api.github.com/repos/aspnet/Diagnostics/pulls/39","_links":{"self":{"href":"https://api.github.com/repos/aspnet/Diagnostics/pulls/comments/18719591"},"html":{"href":"https://github.com/aspnet/Diagnostics/pull/39#discussion_r18719591"},"pull_request":{"href":"https://api.github.com/repos/aspnet/Diagnostics/pulls/39"}}},"pull_request":{"url":"https://api.github.com/repos/aspnet/Diagnostics/pulls/39","id":22526890,"html_url":"https://github.com/aspnet/Diagnostics/pull/39","diff_url":"https://github.com/aspnet/Diagnostics/pull/39.diff","patch_url":"https://github.com/aspnet/Diagnostics/pull/39.patch","issue_url":"https://api.github.com/repos/aspnet/Diagnostics/issues/39","number":39,"state":"open","locked":false,"title":"New ErrorHandler middleware.","user":{"login":"Tratcher","id":1821173,"avatar_url":"https://avatars.githubusercontent.com/u/1821173?v=2","gravatar_id":"","url":"https://api.github.com/users/Tratcher","html_url":"https://github.com/Tratcher","followers_url":"https://api.github.com/users/Tratcher/followers","following_url":"https://api.github.com/users/Tratcher/following{/other_user}","gists_url":"https://api.github.com/users/Tratcher/gists{/gist_id}","starred_url":"https://api.github.com/users/Tratcher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tratcher/subscriptions","organizations_url":"https://api.github.com/users/Tratcher/orgs","repos_url":"https://api.github.com/users/Tratcher/repos","events_url":"https://api.github.com/users/Tratcher/events{/privacy}","received_events_url":"https://api.github.com/users/Tratcher/received_events","type":"User","site_admin":false},"body":"This middleware catches exceptions, logs them, and then re-executes the request to generate an error page. The request can be re-executed down the original pipeline with a modified request path, or down an alternate pipeline.  If anything goes wrong generating the response then the original exception will be re-thrown.\r\n\r\nThe re-execution will not be attempted if the response has already started.\r\n\r\n@loudej @davidfowl @Eilon ","created_at":"2014-10-09T21:56:02Z","updated_at":"2014-10-10T17:42:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0d865f808c28215a4984b3ef5bc69d20e2083740","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/aspnet/Diagnostics/pulls/39/commits","review_comments_url":"https://api.github.com/repos/aspnet/Diagnostics/pulls/39/comments","review_comment_url":"https://api.github.com/repos/aspnet/Diagnostics/pulls/comments/{number}","comments_url":"https://api.github.com/repos/aspnet/Diagnostics/issues/39/comments","statuses_url":"https://api.github.com/repos/aspnet/Diagnostics/statuses/dae8ff5022cf62b256970523cf0db1506ebba421","head":{"label":"aspnet:handler","ref":"handler","sha":"dae8ff5022cf62b256970523cf0db1506ebba421","user":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars.githubusercontent.com/u/6476660?v=2","gravatar_id":"","url":"https://api.github.com/users/aspnet","html_url":"https://github.com/aspnet","followers_url":"https://api.github.com/users/aspnet/followers","following_url":"https://api.github.com/users/aspnet/following{/other_user}","gists_url":"https://api.github.com/users/aspnet/gists{/gist_id}","starred_url":"https://api.github.com/users/aspnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspnet/subscriptions","organizations_url":"https://api.github.com/users/aspnet/orgs","repos_url":"https://api.github.com/users/aspnet/repos","events_url":"https://api.github.com/users/aspnet/events{/privacy}","received_events_url":"https://api.github.com/users/aspnet/received_events","type":"Organization","site_admin":false},"repo":{"id":17548048,"name":"Diagnostics","full_name":"aspnet/Diagnostics","owner":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars.githubusercontent.com/u/6476660?v=2","gravatar_id":"","url":"https://api.github.com/users/aspnet","html_url":"https://github.com/aspnet","followers_url":"https://api.github.com/users/aspnet/followers","following_url":"https://api.github.com/users/aspnet/following{/other_user}","gists_url":"https://api.github.com/users/aspnet/gists{/gist_id}","starred_url":"https://api.github.com/users/aspnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspnet/subscriptions","organizations_url":"https://api.github.com/users/aspnet/orgs","repos_url":"https://api.github.com/users/aspnet/repos","events_url":"https://api.github.com/users/aspnet/events{/privacy}","received_events_url":"https://api.github.com/users/aspnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/aspnet/Diagnostics","description":"","fork":false,"url":"https://api.github.com/repos/aspnet/Diagnostics","forks_url":"https://api.github.com/repos/aspnet/Diagnostics/forks","keys_url":"https://api.github.com/repos/aspnet/Diagnostics/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aspnet/Diagnostics/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aspnet/Diagnostics/teams","hooks_url":"https://api.github.com/repos/aspnet/Diagnostics/hooks","issue_events_url":"https://api.github.com/repos/aspnet/Diagnostics/issues/events{/number}","events_url":"https://api.github.com/repos/aspnet/Diagnostics/events","assignees_url":"https://api.github.com/repos/aspnet/Diagnostics/assignees{/user}","branches_url":"https://api.github.com/repos/aspnet/Diagnostics/branches{/branch}","tags_url":"https://api.github.com/repos/aspnet/Diagnostics/tags","blobs_url":"https://api.github.com/repos/aspnet/Diagnostics/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aspnet/Diagnostics/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aspnet/Diagnostics/git/refs{/sha}","trees_url":"https://api.github.com/repos/aspnet/Diagnostics/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aspnet/Diagnostics/statuses/{sha}","languages_url":"https://api.github.com/repos/aspnet/Diagnostics/languages","stargazers_url":"https://api.github.com/repos/aspnet/Diagnostics/stargazers","contributors_url":"https://api.github.com/repos/aspnet/Diagnostics/contributors","subscribers_url":"https://api.github.com/repos/aspnet/Diagnostics/subscribers","subscription_url":"https://api.github.com/repos/aspnet/Diagnostics/subscription","commits_url":"https://api.github.com/repos/aspnet/Diagnostics/commits{/sha}","git_commits_url":"https://api.github.com/repos/aspnet/Diagnostics/git/commits{/sha}","comments_url":"https://api.github.com/repos/aspnet/Diagnostics/comments{/number}","issue_comment_url":"https://api.github.com/repos/aspnet/Diagnostics/issues/comments/{number}","contents_url":"https://api.github.com/repos/aspnet/Diagnostics/contents/{+path}","compare_url":"https://api.github.com/repos/aspnet/Diagnostics/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aspnet/Diagnostics/merges","archive_url":"https://api.github.com/repos/aspnet/Diagnostics/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aspnet/Diagnostics/downloads","issues_url":"https://api.github.com/repos/aspnet/Diagnostics/issues{/number}","pulls_url":"https://api.github.com/repos/aspnet/Diagnostics/pulls{/number}","milestones_url":"https://api.github.com/repos/aspnet/Diagnostics/milestones{/number}","notifications_url":"https://api.github.com/repos/aspnet/Diagnostics/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aspnet/Diagnostics/labels{/name}","releases_url":"https://api.github.com/repos/aspnet/Diagnostics/releases{/id}","created_at":"2014-03-08T18:25:57Z","updated_at":"2014-10-02T00:48:56Z","pushed_at":"2014-10-10T17:40:08Z","git_url":"git://github.com/aspnet/Diagnostics.git","ssh_url":"git@github.com:aspnet/Diagnostics.git","clone_url":"https://github.com/aspnet/Diagnostics.git","svn_url":"https://github.com/aspnet/Diagnostics","homepage":"","size":1270,"stargazers_count":16,"watchers_count":16,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":9,"mirror_url":null,"open_issues_count":16,"forks":9,"open_issues":16,"watchers":16,"default_branch":"dev"}},"base":{"label":"aspnet:dev","ref":"dev","sha":"001639ff484cd019fa144982f8a2d5a6c57011a2","user":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars.githubusercontent.com/u/6476660?v=2","gravatar_id":"","url":"https://api.github.com/users/aspnet","html_url":"https://github.com/aspnet","followers_url":"https://api.github.com/users/aspnet/followers","following_url":"https://api.github.com/users/aspnet/following{/other_user}","gists_url":"https://api.github.com/users/aspnet/gists{/gist_id}","starred_url":"https://api.github.com/users/aspnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspnet/subscriptions","organizations_url":"https://api.github.com/users/aspnet/orgs","repos_url":"https://api.github.com/users/aspnet/repos","events_url":"https://api.github.com/users/aspnet/events{/privacy}","received_events_url":"https://api.github.com/users/aspnet/received_events","type":"Organization","site_admin":false},"repo":{"id":17548048,"name":"Diagnostics","full_name":"aspnet/Diagnostics","owner":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars.githubusercontent.com/u/6476660?v=2","gravatar_id":"","url":"https://api.github.com/users/aspnet","html_url":"https://github.com/aspnet","followers_url":"https://api.github.com/users/aspnet/followers","following_url":"https://api.github.com/users/aspnet/following{/other_user}","gists_url":"https://api.github.com/users/aspnet/gists{/gist_id}","starred_url":"https://api.github.com/users/aspnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspnet/subscriptions","organizations_url":"https://api.github.com/users/aspnet/orgs","repos_url":"https://api.github.com/users/aspnet/repos","events_url":"https://api.github.com/users/aspnet/events{/privacy}","received_events_url":"https://api.github.com/users/aspnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/aspnet/Diagnostics","description":"","fork":false,"url":"https://api.github.com/repos/aspnet/Diagnostics","forks_url":"https://api.github.com/repos/aspnet/Diagnostics/forks","keys_url":"https://api.github.com/repos/aspnet/Diagnostics/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aspnet/Diagnostics/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aspnet/Diagnostics/teams","hooks_url":"https://api.github.com/repos/aspnet/Diagnostics/hooks","issue_events_url":"https://api.github.com/repos/aspnet/Diagnostics/issues/events{/number}","events_url":"https://api.github.com/repos/aspnet/Diagnostics/events","assignees_url":"https://api.github.com/repos/aspnet/Diagnostics/assignees{/user}","branches_url":"https://api.github.com/repos/aspnet/Diagnostics/branches{/branch}","tags_url":"https://api.github.com/repos/aspnet/Diagnostics/tags","blobs_url":"https://api.github.com/repos/aspnet/Diagnostics/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aspnet/Diagnostics/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aspnet/Diagnostics/git/refs{/sha}","trees_url":"https://api.github.com/repos/aspnet/Diagnostics/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aspnet/Diagnostics/statuses/{sha}","languages_url":"https://api.github.com/repos/aspnet/Diagnostics/languages","stargazers_url":"https://api.github.com/repos/aspnet/Diagnostics/stargazers","contributors_url":"https://api.github.com/repos/aspnet/Diagnostics/contributors","subscribers_url":"https://api.github.com/repos/aspnet/Diagnostics/subscribers","subscription_url":"https://api.github.com/repos/aspnet/Diagnostics/subscription","commits_url":"https://api.github.com/repos/aspnet/Diagnostics/commits{/sha}","git_commits_url":"https://api.github.com/repos/aspnet/Diagnostics/git/commits{/sha}","comments_url":"https://api.github.com/repos/aspnet/Diagnostics/comments{/number}","issue_comment_url":"https://api.github.com/repos/aspnet/Diagnostics/issues/comments/{number}","contents_url":"https://api.github.com/repos/aspnet/Diagnostics/contents/{+path}","compare_url":"https://api.github.com/repos/aspnet/Diagnostics/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aspnet/Diagnostics/merges","archive_url":"https://api.github.com/repos/aspnet/Diagnostics/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aspnet/Diagnostics/downloads","issues_url":"https://api.github.com/repos/aspnet/Diagnostics/issues{/number}","pulls_url":"https://api.github.com/repos/aspnet/Diagnostics/pulls{/number}","milestones_url":"https://api.github.com/repos/aspnet/Diagnostics/milestones{/number}","notifications_url":"https://api.github.com/repos/aspnet/Diagnostics/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aspnet/Diagnostics/labels{/name}","releases_url":"https://api.github.com/repos/aspnet/Diagnostics/releases{/id}","created_at":"2014-03-08T18:25:57Z","updated_at":"2014-10-02T00:48:56Z","pushed_at":"2014-10-10T17:40:08Z","git_url":"git://github.com/aspnet/Diagnostics.git","ssh_url":"git@github.com:aspnet/Diagnostics.git","clone_url":"https://github.com/aspnet/Diagnostics.git","svn_url":"https://github.com/aspnet/Diagnostics","homepage":"","size":1270,"stargazers_count":16,"watchers_count":16,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":9,"mirror_url":null,"open_issues_count":16,"forks":9,"open_issues":16,"watchers":16,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/aspnet/Diagnostics/pulls/39"},"html":{"href":"https://github.com/aspnet/Diagnostics/pull/39"},"issue":{"href":"https://api.github.com/repos/aspnet/Diagnostics/issues/39"},"comments":{"href":"https://api.github.com/repos/aspnet/Diagnostics/issues/39/comments"},"review_comments":{"href":"https://api.github.com/repos/aspnet/Diagnostics/pulls/39/comments"},"review_comment":{"href":"https://api.github.com/repos/aspnet/Diagnostics/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/aspnet/Diagnostics/pulls/39/commits"},"statuses":{"href":"https://api.github.com/repos/aspnet/Diagnostics/statuses/dae8ff5022cf62b256970523cf0db1506ebba421"}}}}