{"action":"created","comment":{"url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/pulls/comments/104262460","pull_request_review_id":25091696,"id":104262460,"diff_hunk":"@@ -351,23 +343,72 @@ private bool HasJobAttribute(CustomAttributeData attributeData)\n             };\n         }\n \n-        private class ListenerFactory : IListenerFactory\n+        internal class ListenerFactory : IListenerFactory\n         {\n             private readonly FunctionDescriptor _descriptor;\n             private readonly ITriggeredFunctionExecutor _executor;\n             private readonly ITriggerBinding _binding;\n+            private readonly TraceWriter _trace;\n \n-            public ListenerFactory(FunctionDescriptor descriptor, ITriggeredFunctionExecutor executor, ITriggerBinding binding)\n+            public ListenerFactory(FunctionDescriptor descriptor, ITriggeredFunctionExecutor executor, ITriggerBinding binding, TraceWriter trace)\n             {\n                 _descriptor = descriptor;\n                 _executor = executor;\n                 _binding = binding;\n+                _trace = trace;\n             }\n \n-            public Task<IListener> CreateAsync(CancellationToken cancellationToken)\n+            public async Task<IListener> CreateAsync(CancellationToken cancellationToken)\n             {\n                 ListenerFactoryContext context = new ListenerFactoryContext(_descriptor, _executor, cancellationToken);\n-                return _binding.CreateListenerAsync(context);\n+                IListener listener = await _binding.CreateListenerAsync(context);\n+                return new TriggerListener(listener, _descriptor, _trace);\n+            }\n+\n+            private class TriggerListener : IListener\n+            {\n+                private readonly IListener _listener;\n+                private readonly FunctionDescriptor _descriptor;\n+                private readonly TraceWriter _trace;\n+\n+                public TriggerListener(IListener listener, FunctionDescriptor descriptor, TraceWriter trace)\n+                {\n+                    _listener = listener;\n+                    _descriptor = descriptor;\n+                    _trace = trace;\n+                }\n+\n+                public void Cancel()\n+                {\n+                    _listener.Cancel();\n+                }\n+\n+                public void Dispose()\n+                {\n+                    _listener.Dispose();\n+                }\n+\n+                public async Task StartAsync(CancellationToken cancellationToken)\n+                {\n+                    try\n+                    {\n+                        await _listener.StartAsync(cancellationToken);\n+                    }\n+                    catch (Exception e)\n+                    {\n+                        var fex = new FunctionIndexingException(_descriptor.ShortName, e);\n+                        _trace.Error(e.Message, fex);\n+                        if (!fex.Handled)\n+                        {\n+                            throw;\n+                        }\n+                    }\n+                }\n+\n+                public Task StopAsync(CancellationToken cancellationToken)\n+                {","path":"src/Microsoft.Azure.WebJobs.Host/Indexers/FunctionIndexer.cs","position":113,"original_position":113,"commit_id":"f5175884d59f9aa0331d4bc6d25bcfe05396c893","original_commit_id":"f5175884d59f9aa0331d4bc6d25bcfe05396c893","user":{"login":"mathewc","id":1056548,"avatar_url":"https://avatars0.githubusercontent.com/u/1056548?v=3","gravatar_id":"","url":"https://api.github.com/users/mathewc","html_url":"https://github.com/mathewc","followers_url":"https://api.github.com/users/mathewc/followers","following_url":"https://api.github.com/users/mathewc/following{/other_user}","gists_url":"https://api.github.com/users/mathewc/gists{/gist_id}","starred_url":"https://api.github.com/users/mathewc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mathewc/subscriptions","organizations_url":"https://api.github.com/users/mathewc/orgs","repos_url":"https://api.github.com/users/mathewc/repos","events_url":"https://api.github.com/users/mathewc/events{/privacy}","received_events_url":"https://api.github.com/users/mathewc/received_events","type":"User","site_admin":false},"body":"If you look at all our other listeners, I don't think we're very good about this in general. If we think we have improvements in this area to make to listeners, I'd say its a new bug. Traditionally from the core SDK point of view, listener startup exceptions are intended to bring down the entire host and process. In that case, stop would never be called.","created_at":"2017-03-03T23:20:39Z","updated_at":"2017-03-03T23:20:39Z","html_url":"https://github.com/Azure/azure-webjobs-sdk/pull/1035#discussion_r104262460","pull_request_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/pulls/1035","_links":{"self":{"href":"https://api.github.com/repos/Azure/azure-webjobs-sdk/pulls/comments/104262460"},"html":{"href":"https://github.com/Azure/azure-webjobs-sdk/pull/1035#discussion_r104262460"},"pull_request":{"href":"https://api.github.com/repos/Azure/azure-webjobs-sdk/pulls/1035"}}},"pull_request":{"url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/pulls/1035","id":107502395,"html_url":"https://github.com/Azure/azure-webjobs-sdk/pull/1035","diff_url":"https://github.com/Azure/azure-webjobs-sdk/pull/1035.diff","patch_url":"https://github.com/Azure/azure-webjobs-sdk/pull/1035.patch","issue_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/issues/1035","number":1035,"state":"open","locked":false,"title":"Propagate trigger listener exceptions","user":{"login":"mamaso","id":9870694,"avatar_url":"https://avatars2.githubusercontent.com/u/9870694?v=3","gravatar_id":"","url":"https://api.github.com/users/mamaso","html_url":"https://github.com/mamaso","followers_url":"https://api.github.com/users/mamaso/followers","following_url":"https://api.github.com/users/mamaso/following{/other_user}","gists_url":"https://api.github.com/users/mamaso/gists{/gist_id}","starred_url":"https://api.github.com/users/mamaso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mamaso/subscriptions","organizations_url":"https://api.github.com/users/mamaso/orgs","repos_url":"https://api.github.com/users/mamaso/repos","events_url":"https://api.github.com/users/mamaso/events{/privacy}","received_events_url":"https://api.github.com/users/mamaso/received_events","type":"User","site_admin":false},"body":"resolves #996 \r\n\r\nWrap function trigger listeners to catch errors and trace FunctionIndexingExceptions (which will be picked up by script). If handled, swallow, otherwise throw.\r\n\r\nAlso changed the `CreateTriggeredFunctionDefinition` method to be a bit less unwieldy (static -> instance and removed intermediate method to lessen parameter passing)\r\n\r\nNo longer requires any changes in script.","created_at":"2017-02-22T21:29:48Z","updated_at":"2017-03-03T23:20:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"88c18fc72afc8cfa131303a8026ba44e458818f5","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/pulls/1035/commits","review_comments_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/pulls/1035/comments","review_comment_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/issues/1035/comments","statuses_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/statuses/f5175884d59f9aa0331d4bc6d25bcfe05396c893","head":{"label":"mamaso:listenerExceptions","ref":"listenerExceptions","sha":"f5175884d59f9aa0331d4bc6d25bcfe05396c893","user":{"login":"mamaso","id":9870694,"avatar_url":"https://avatars2.githubusercontent.com/u/9870694?v=3","gravatar_id":"","url":"https://api.github.com/users/mamaso","html_url":"https://github.com/mamaso","followers_url":"https://api.github.com/users/mamaso/followers","following_url":"https://api.github.com/users/mamaso/following{/other_user}","gists_url":"https://api.github.com/users/mamaso/gists{/gist_id}","starred_url":"https://api.github.com/users/mamaso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mamaso/subscriptions","organizations_url":"https://api.github.com/users/mamaso/orgs","repos_url":"https://api.github.com/users/mamaso/repos","events_url":"https://api.github.com/users/mamaso/events{/privacy}","received_events_url":"https://api.github.com/users/mamaso/received_events","type":"User","site_admin":false},"repo":{"id":73947312,"name":"azure-webjobs-sdk","full_name":"mamaso/azure-webjobs-sdk","owner":{"login":"mamaso","id":9870694,"avatar_url":"https://avatars2.githubusercontent.com/u/9870694?v=3","gravatar_id":"","url":"https://api.github.com/users/mamaso","html_url":"https://github.com/mamaso","followers_url":"https://api.github.com/users/mamaso/followers","following_url":"https://api.github.com/users/mamaso/following{/other_user}","gists_url":"https://api.github.com/users/mamaso/gists{/gist_id}","starred_url":"https://api.github.com/users/mamaso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mamaso/subscriptions","organizations_url":"https://api.github.com/users/mamaso/orgs","repos_url":"https://api.github.com/users/mamaso/repos","events_url":"https://api.github.com/users/mamaso/events{/privacy}","received_events_url":"https://api.github.com/users/mamaso/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mamaso/azure-webjobs-sdk","description":"Azure WebJobs SDK","fork":true,"url":"https://api.github.com/repos/mamaso/azure-webjobs-sdk","forks_url":"https://api.github.com/repos/mamaso/azure-webjobs-sdk/forks","keys_url":"https://api.github.com/repos/mamaso/azure-webjobs-sdk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mamaso/azure-webjobs-sdk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mamaso/azure-webjobs-sdk/teams","hooks_url":"https://api.github.com/repos/mamaso/azure-webjobs-sdk/hooks","issue_events_url":"https://api.github.com/repos/mamaso/azure-webjobs-sdk/issues/events{/number}","events_url":"https://api.github.com/repos/mamaso/azure-webjobs-sdk/events","assignees_url":"https://api.github.com/repos/mamaso/azure-webjobs-sdk/assignees{/user}","branches_url":"https://api.github.com/repos/mamaso/azure-webjobs-sdk/branches{/branch}","tags_url":"https://api.github.com/repos/mamaso/azure-webjobs-sdk/tags","blobs_url":"https://api.github.com/repos/mamaso/azure-webjobs-sdk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mamaso/azure-webjobs-sdk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mamaso/azure-webjobs-sdk/git/refs{/sha}","trees_url":"https://api.github.com/repos/mamaso/azure-webjobs-sdk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mamaso/azure-webjobs-sdk/statuses/{sha}","languages_url":"https://api.github.com/repos/mamaso/azure-webjobs-sdk/languages","stargazers_url":"https://api.github.com/repos/mamaso/azure-webjobs-sdk/stargazers","contributors_url":"https://api.github.com/repos/mamaso/azure-webjobs-sdk/contributors","subscribers_url":"https://api.github.com/repos/mamaso/azure-webjobs-sdk/subscribers","subscription_url":"https://api.github.com/repos/mamaso/azure-webjobs-sdk/subscription","commits_url":"https://api.github.com/repos/mamaso/azure-webjobs-sdk/commits{/sha}","git_commits_url":"https://api.github.com/repos/mamaso/azure-webjobs-sdk/git/commits{/sha}","comments_url":"https://api.github.com/repos/mamaso/azure-webjobs-sdk/comments{/number}","issue_comment_url":"https://api.github.com/repos/mamaso/azure-webjobs-sdk/issues/comments{/number}","contents_url":"https://api.github.com/repos/mamaso/azure-webjobs-sdk/contents/{+path}","compare_url":"https://api.github.com/repos/mamaso/azure-webjobs-sdk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mamaso/azure-webjobs-sdk/merges","archive_url":"https://api.github.com/repos/mamaso/azure-webjobs-sdk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mamaso/azure-webjobs-sdk/downloads","issues_url":"https://api.github.com/repos/mamaso/azure-webjobs-sdk/issues{/number}","pulls_url":"https://api.github.com/repos/mamaso/azure-webjobs-sdk/pulls{/number}","milestones_url":"https://api.github.com/repos/mamaso/azure-webjobs-sdk/milestones{/number}","notifications_url":"https://api.github.com/repos/mamaso/azure-webjobs-sdk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mamaso/azure-webjobs-sdk/labels{/name}","releases_url":"https://api.github.com/repos/mamaso/azure-webjobs-sdk/releases{/id}","deployments_url":"https://api.github.com/repos/mamaso/azure-webjobs-sdk/deployments","created_at":"2016-11-16T18:09:54Z","updated_at":"2016-11-16T18:09:57Z","pushed_at":"2017-02-24T23:55:29Z","git_url":"git://github.com/mamaso/azure-webjobs-sdk.git","ssh_url":"git@github.com:mamaso/azure-webjobs-sdk.git","clone_url":"https://github.com/mamaso/azure-webjobs-sdk.git","svn_url":"https://github.com/mamaso/azure-webjobs-sdk","homepage":"","size":12562,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"dev"}},"base":{"label":"Azure:dev","ref":"dev","sha":"a9cc08973539b0badc068dc901a015bd13ade501","user":{"login":"Azure","id":6844498,"avatar_url":"https://avatars3.githubusercontent.com/u/6844498?v=3","gravatar_id":"","url":"https://api.github.com/users/Azure","html_url":"https://github.com/Azure","followers_url":"https://api.github.com/users/Azure/followers","following_url":"https://api.github.com/users/Azure/following{/other_user}","gists_url":"https://api.github.com/users/Azure/gists{/gist_id}","starred_url":"https://api.github.com/users/Azure/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Azure/subscriptions","organizations_url":"https://api.github.com/users/Azure/orgs","repos_url":"https://api.github.com/users/Azure/repos","events_url":"https://api.github.com/users/Azure/events{/privacy}","received_events_url":"https://api.github.com/users/Azure/received_events","type":"Organization","site_admin":false},"repo":{"id":21712185,"name":"azure-webjobs-sdk","full_name":"Azure/azure-webjobs-sdk","owner":{"login":"Azure","id":6844498,"avatar_url":"https://avatars3.githubusercontent.com/u/6844498?v=3","gravatar_id":"","url":"https://api.github.com/users/Azure","html_url":"https://github.com/Azure","followers_url":"https://api.github.com/users/Azure/followers","following_url":"https://api.github.com/users/Azure/following{/other_user}","gists_url":"https://api.github.com/users/Azure/gists{/gist_id}","starred_url":"https://api.github.com/users/Azure/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Azure/subscriptions","organizations_url":"https://api.github.com/users/Azure/orgs","repos_url":"https://api.github.com/users/Azure/repos","events_url":"https://api.github.com/users/Azure/events{/privacy}","received_events_url":"https://api.github.com/users/Azure/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Azure/azure-webjobs-sdk","description":"Azure WebJobs SDK","fork":false,"url":"https://api.github.com/repos/Azure/azure-webjobs-sdk","forks_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/forks","keys_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/teams","hooks_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/hooks","issue_events_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/issues/events{/number}","events_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/events","assignees_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/assignees{/user}","branches_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/branches{/branch}","tags_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/tags","blobs_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/git/refs{/sha}","trees_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/statuses/{sha}","languages_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/languages","stargazers_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/stargazers","contributors_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/contributors","subscribers_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/subscribers","subscription_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/subscription","commits_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/commits{/sha}","git_commits_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/git/commits{/sha}","comments_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/comments{/number}","issue_comment_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/issues/comments{/number}","contents_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/contents/{+path}","compare_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/merges","archive_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/downloads","issues_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/issues{/number}","pulls_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/pulls{/number}","milestones_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/milestones{/number}","notifications_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/labels{/name}","releases_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/releases{/id}","deployments_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk/deployments","created_at":"2014-07-10T22:15:31Z","updated_at":"2017-03-01T15:51:59Z","pushed_at":"2017-03-02T19:35:27Z","git_url":"git://github.com/Azure/azure-webjobs-sdk.git","ssh_url":"git@github.com:Azure/azure-webjobs-sdk.git","clone_url":"https://github.com/Azure/azure-webjobs-sdk.git","svn_url":"https://github.com/Azure/azure-webjobs-sdk","homepage":"","size":12658,"stargazers_count":180,"watchers_count":180,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":85,"mirror_url":null,"open_issues_count":238,"forks":85,"open_issues":238,"watchers":180,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/Azure/azure-webjobs-sdk/pulls/1035"},"html":{"href":"https://github.com/Azure/azure-webjobs-sdk/pull/1035"},"issue":{"href":"https://api.github.com/repos/Azure/azure-webjobs-sdk/issues/1035"},"comments":{"href":"https://api.github.com/repos/Azure/azure-webjobs-sdk/issues/1035/comments"},"review_comments":{"href":"https://api.github.com/repos/Azure/azure-webjobs-sdk/pulls/1035/comments"},"review_comment":{"href":"https://api.github.com/repos/Azure/azure-webjobs-sdk/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Azure/azure-webjobs-sdk/pulls/1035/commits"},"statuses":{"href":"https://api.github.com/repos/Azure/azure-webjobs-sdk/statuses/f5175884d59f9aa0331d4bc6d25bcfe05396c893"}}}}
{"actor":{"display_login":"mathewc"}}