{"action":"created","comment":{"url":"https://api.github.com/repos/D-Programming-Language/phobos/pulls/comments/23318087","id":23318087,"diff_hunk":"@@ -1613,3 +1614,462 @@ version(unittest) package\n     static assert({ cast(void)dg(); return true; }());\n     cast(void)dg();\n }\n+\n+/** This $(D enum) is used to select the methods of the range to handle by the\n+  $(D handle) range wrapper. The values of the $(D enum) can be OR'd to\n+  selected multiple primitives to be handled.\n+ */\n+enum RangePrimitive\n+{\n+    front    = 0b00_0000_0001,\n+    back     = 0b00_0000_0010,\n+    popFront = 0b00_0000_0100,\n+    popBack  = 0b00_0000_1000,\n+    empty    = 0b00_0001_0000,\n+    save     = 0b00_0010_0000,\n+    length   = 0b00_0100_0000,\n+    opDollar = 0b00_1000_0000,\n+    opIndex  = 0b01_0000_0000,\n+    opSlice  = 0b10_0000_0000,\n+}\n+\n+/** This range handles exceptions originating in ranges.\n+\n+To use the range the code has to specify what methods of the range should be\n+handled. This is done by use of the $(LREF $(D RangePrimitive)) enum. Multiple\n+methods of a range can be handled at once, by using the or operator two\n+combine multiple $(D RangePrimitive). If more than one method should be\n+handled by one user supplied handler, all methods must have the same sigature.\n+\n+The $(D handler) $(D alias) must takes a $(D Throwable) as first of type $(D\n+R) as first argument a range of type $(D IRange) as second argument. The\n+return type of the $(D alias) must be equal to the return type of the\n+primitive handled.\n+\n+Params:\n+    E = The type of Throwable to handle.\n+    functionsToHandle = The $(D RangePrimitive) selecting which primitives to\n+        handle.\n+    handler = The callable that is called when a handled primitive throw an\n+    $(D Throwable) of type $(D E). The handler must have the same return type\n+    as the handled primitive and must accepect parameters of the $(D E, ref\n+    IRange).\n+    input = The range to handle.\n+\n+Returns: A wrapper $(D struct) that preserves the $(D range) interface of the\n+passed $(D IRange input).\n+*/\n+auto handle(E : Throwable, RangePrimitive functionsToHandle, alias handler, IRange)(IRange input)\n+if (isInputRange!IRange)\n+{\n+    static struct Handler(E : Throwable, alias handler, IRange)\n+    {\n+        IRange range;\n+\n+        static if (isForwardRange!IRange)\n+        {\n+            static if (functionsToHandle & RangePrimitive.save)\n+            {\n+                @property typeof(this) save()\n+                {\n+                    try\n+                    {\n+                        return typeof(this)(range.save());","path":"std/exception.d","position":81,"original_position":81,"commit_id":"fed78d36926f959ee6239ba775ce882ada73ca35","original_commit_id":"fed78d36926f959ee6239ba775ce882ada73ca35","user":{"login":"quickfur","id":405446,"avatar_url":"https://avatars.githubusercontent.com/u/405446?v=3","gravatar_id":"","url":"https://api.github.com/users/quickfur","html_url":"https://github.com/quickfur","followers_url":"https://api.github.com/users/quickfur/followers","following_url":"https://api.github.com/users/quickfur/following{/other_user}","gists_url":"https://api.github.com/users/quickfur/gists{/gist_id}","starred_url":"https://api.github.com/users/quickfur/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/quickfur/subscriptions","organizations_url":"https://api.github.com/users/quickfur/orgs","repos_url":"https://api.github.com/users/quickfur/repos","events_url":"https://api.github.com/users/quickfur/events{/privacy}","received_events_url":"https://api.github.com/users/quickfur/received_events","type":"User","site_admin":false},"body":"Since `.save` is `@property`, it should not be invoked with parentheses, i.e., should be `range.save` instead of `range.save()`.","created_at":"2015-01-21T17:42:20Z","updated_at":"2015-01-21T17:42:20Z","html_url":"https://github.com/D-Programming-Language/phobos/pull/2724#discussion_r23318087","pull_request_url":"https://api.github.com/repos/D-Programming-Language/phobos/pulls/2724","_links":{"self":{"href":"https://api.github.com/repos/D-Programming-Language/phobos/pulls/comments/23318087"},"html":{"href":"https://github.com/D-Programming-Language/phobos/pull/2724#discussion_r23318087"},"pull_request":{"href":"https://api.github.com/repos/D-Programming-Language/phobos/pulls/2724"}}},"pull_request":{"url":"https://api.github.com/repos/D-Programming-Language/phobos/pulls/2724","id":24476843,"html_url":"https://github.com/D-Programming-Language/phobos/pull/2724","diff_url":"https://github.com/D-Programming-Language/phobos/pull/2724.diff","patch_url":"https://github.com/D-Programming-Language/phobos/pull/2724.patch","issue_url":"https://api.github.com/repos/D-Programming-Language/phobos/issues/2724","number":2724,"state":"open","locked":false,"title":"Rangeexception","user":{"login":"burner","id":13327,"avatar_url":"https://avatars.githubusercontent.com/u/13327?v=3","gravatar_id":"","url":"https://api.github.com/users/burner","html_url":"https://github.com/burner","followers_url":"https://api.github.com/users/burner/followers","following_url":"https://api.github.com/users/burner/following{/other_user}","gists_url":"https://api.github.com/users/burner/gists{/gist_id}","starred_url":"https://api.github.com/users/burner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/burner/subscriptions","organizations_url":"https://api.github.com/users/burner/orgs","repos_url":"https://api.github.com/users/burner/repos","events_url":"https://api.github.com/users/burner/events{/privacy}","received_events_url":"https://api.github.com/users/burner/received_events","type":"User","site_admin":false},"body":"When an Exception is thrown by a Range the execution of the Range is usually aborted.\r\nThis PR add two functions:\r\n\r\n* handleFront\r\n* handlePopFront\r\n\r\nthat wrap a Range and call the functions front and popFront of the wrapped Range. If the wrapped Range throws an Exception an user provided handler is called. This handler gets the Range and the Exception passed and can then be used to handle the Exception and put the Range in an workable state again.\r\n\r\nAdditional PRs will add handler Ranges for back|popBack, empty and opIndex","created_at":"2014-11-14T22:56:46Z","updated_at":"2015-01-21T17:42:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9c7643b2072147d83df518e5fd9de2ff6919584d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/D-Programming-Language/phobos/pulls/2724/commits","review_comments_url":"https://api.github.com/repos/D-Programming-Language/phobos/pulls/2724/comments","review_comment_url":"https://api.github.com/repos/D-Programming-Language/phobos/pulls/comments/{number}","comments_url":"https://api.github.com/repos/D-Programming-Language/phobos/issues/2724/comments","statuses_url":"https://api.github.com/repos/D-Programming-Language/phobos/statuses/fed78d36926f959ee6239ba775ce882ada73ca35","head":{"label":"burner:rangeexception_front","ref":"rangeexception_front","sha":"fed78d36926f959ee6239ba775ce882ada73ca35","user":{"login":"burner","id":13327,"avatar_url":"https://avatars.githubusercontent.com/u/13327?v=3","gravatar_id":"","url":"https://api.github.com/users/burner","html_url":"https://github.com/burner","followers_url":"https://api.github.com/users/burner/followers","following_url":"https://api.github.com/users/burner/following{/other_user}","gists_url":"https://api.github.com/users/burner/gists{/gist_id}","starred_url":"https://api.github.com/users/burner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/burner/subscriptions","organizations_url":"https://api.github.com/users/burner/orgs","repos_url":"https://api.github.com/users/burner/repos","events_url":"https://api.github.com/users/burner/events{/privacy}","received_events_url":"https://api.github.com/users/burner/received_events","type":"User","site_admin":false},"repo":{"id":7882025,"name":"phobos","full_name":"burner/phobos","owner":{"login":"burner","id":13327,"avatar_url":"https://avatars.githubusercontent.com/u/13327?v=3","gravatar_id":"","url":"https://api.github.com/users/burner","html_url":"https://github.com/burner","followers_url":"https://api.github.com/users/burner/followers","following_url":"https://api.github.com/users/burner/following{/other_user}","gists_url":"https://api.github.com/users/burner/gists{/gist_id}","starred_url":"https://api.github.com/users/burner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/burner/subscriptions","organizations_url":"https://api.github.com/users/burner/orgs","repos_url":"https://api.github.com/users/burner/repos","events_url":"https://api.github.com/users/burner/events{/privacy}","received_events_url":"https://api.github.com/users/burner/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/burner/phobos","description":"The standard library of the D programming language","fork":true,"url":"https://api.github.com/repos/burner/phobos","forks_url":"https://api.github.com/repos/burner/phobos/forks","keys_url":"https://api.github.com/repos/burner/phobos/keys{/key_id}","collaborators_url":"https://api.github.com/repos/burner/phobos/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/burner/phobos/teams","hooks_url":"https://api.github.com/repos/burner/phobos/hooks","issue_events_url":"https://api.github.com/repos/burner/phobos/issues/events{/number}","events_url":"https://api.github.com/repos/burner/phobos/events","assignees_url":"https://api.github.com/repos/burner/phobos/assignees{/user}","branches_url":"https://api.github.com/repos/burner/phobos/branches{/branch}","tags_url":"https://api.github.com/repos/burner/phobos/tags","blobs_url":"https://api.github.com/repos/burner/phobos/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/burner/phobos/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/burner/phobos/git/refs{/sha}","trees_url":"https://api.github.com/repos/burner/phobos/git/trees{/sha}","statuses_url":"https://api.github.com/repos/burner/phobos/statuses/{sha}","languages_url":"https://api.github.com/repos/burner/phobos/languages","stargazers_url":"https://api.github.com/repos/burner/phobos/stargazers","contributors_url":"https://api.github.com/repos/burner/phobos/contributors","subscribers_url":"https://api.github.com/repos/burner/phobos/subscribers","subscription_url":"https://api.github.com/repos/burner/phobos/subscription","commits_url":"https://api.github.com/repos/burner/phobos/commits{/sha}","git_commits_url":"https://api.github.com/repos/burner/phobos/git/commits{/sha}","comments_url":"https://api.github.com/repos/burner/phobos/comments{/number}","issue_comment_url":"https://api.github.com/repos/burner/phobos/issues/comments/{number}","contents_url":"https://api.github.com/repos/burner/phobos/contents/{+path}","compare_url":"https://api.github.com/repos/burner/phobos/compare/{base}...{head}","merges_url":"https://api.github.com/repos/burner/phobos/merges","archive_url":"https://api.github.com/repos/burner/phobos/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/burner/phobos/downloads","issues_url":"https://api.github.com/repos/burner/phobos/issues{/number}","pulls_url":"https://api.github.com/repos/burner/phobos/pulls{/number}","milestones_url":"https://api.github.com/repos/burner/phobos/milestones{/number}","notifications_url":"https://api.github.com/repos/burner/phobos/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/burner/phobos/labels{/name}","releases_url":"https://api.github.com/repos/burner/phobos/releases{/id}","created_at":"2013-01-29T00:26:08Z","updated_at":"2014-08-13T09:47:42Z","pushed_at":"2015-01-21T16:53:53Z","git_url":"git://github.com/burner/phobos.git","ssh_url":"git@github.com:burner/phobos.git","clone_url":"https://github.com/burner/phobos.git","svn_url":"https://github.com/burner/phobos","homepage":"dlang.org/phobos","size":38801,"stargazers_count":0,"watchers_count":0,"language":"D","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"D-Programming-Language:master","ref":"master","sha":"356c5e9a4724c0f8af17211f15d75a0a578f4917","user":{"login":"D-Programming-Language","id":565913,"avatar_url":"https://avatars.githubusercontent.com/u/565913?v=3","gravatar_id":"","url":"https://api.github.com/users/D-Programming-Language","html_url":"https://github.com/D-Programming-Language","followers_url":"https://api.github.com/users/D-Programming-Language/followers","following_url":"https://api.github.com/users/D-Programming-Language/following{/other_user}","gists_url":"https://api.github.com/users/D-Programming-Language/gists{/gist_id}","starred_url":"https://api.github.com/users/D-Programming-Language/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/D-Programming-Language/subscriptions","organizations_url":"https://api.github.com/users/D-Programming-Language/orgs","repos_url":"https://api.github.com/users/D-Programming-Language/repos","events_url":"https://api.github.com/users/D-Programming-Language/events{/privacy}","received_events_url":"https://api.github.com/users/D-Programming-Language/received_events","type":"Organization","site_admin":false},"repo":{"id":1257084,"name":"phobos","full_name":"D-Programming-Language/phobos","owner":{"login":"D-Programming-Language","id":565913,"avatar_url":"https://avatars.githubusercontent.com/u/565913?v=3","gravatar_id":"","url":"https://api.github.com/users/D-Programming-Language","html_url":"https://github.com/D-Programming-Language","followers_url":"https://api.github.com/users/D-Programming-Language/followers","following_url":"https://api.github.com/users/D-Programming-Language/following{/other_user}","gists_url":"https://api.github.com/users/D-Programming-Language/gists{/gist_id}","starred_url":"https://api.github.com/users/D-Programming-Language/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/D-Programming-Language/subscriptions","organizations_url":"https://api.github.com/users/D-Programming-Language/orgs","repos_url":"https://api.github.com/users/D-Programming-Language/repos","events_url":"https://api.github.com/users/D-Programming-Language/events{/privacy}","received_events_url":"https://api.github.com/users/D-Programming-Language/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/D-Programming-Language/phobos","description":"The standard library of the D programming language","fork":false,"url":"https://api.github.com/repos/D-Programming-Language/phobos","forks_url":"https://api.github.com/repos/D-Programming-Language/phobos/forks","keys_url":"https://api.github.com/repos/D-Programming-Language/phobos/keys{/key_id}","collaborators_url":"https://api.github.com/repos/D-Programming-Language/phobos/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/D-Programming-Language/phobos/teams","hooks_url":"https://api.github.com/repos/D-Programming-Language/phobos/hooks","issue_events_url":"https://api.github.com/repos/D-Programming-Language/phobos/issues/events{/number}","events_url":"https://api.github.com/repos/D-Programming-Language/phobos/events","assignees_url":"https://api.github.com/repos/D-Programming-Language/phobos/assignees{/user}","branches_url":"https://api.github.com/repos/D-Programming-Language/phobos/branches{/branch}","tags_url":"https://api.github.com/repos/D-Programming-Language/phobos/tags","blobs_url":"https://api.github.com/repos/D-Programming-Language/phobos/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/D-Programming-Language/phobos/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/D-Programming-Language/phobos/git/refs{/sha}","trees_url":"https://api.github.com/repos/D-Programming-Language/phobos/git/trees{/sha}","statuses_url":"https://api.github.com/repos/D-Programming-Language/phobos/statuses/{sha}","languages_url":"https://api.github.com/repos/D-Programming-Language/phobos/languages","stargazers_url":"https://api.github.com/repos/D-Programming-Language/phobos/stargazers","contributors_url":"https://api.github.com/repos/D-Programming-Language/phobos/contributors","subscribers_url":"https://api.github.com/repos/D-Programming-Language/phobos/subscribers","subscription_url":"https://api.github.com/repos/D-Programming-Language/phobos/subscription","commits_url":"https://api.github.com/repos/D-Programming-Language/phobos/commits{/sha}","git_commits_url":"https://api.github.com/repos/D-Programming-Language/phobos/git/commits{/sha}","comments_url":"https://api.github.com/repos/D-Programming-Language/phobos/comments{/number}","issue_comment_url":"https://api.github.com/repos/D-Programming-Language/phobos/issues/comments/{number}","contents_url":"https://api.github.com/repos/D-Programming-Language/phobos/contents/{+path}","compare_url":"https://api.github.com/repos/D-Programming-Language/phobos/compare/{base}...{head}","merges_url":"https://api.github.com/repos/D-Programming-Language/phobos/merges","archive_url":"https://api.github.com/repos/D-Programming-Language/phobos/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/D-Programming-Language/phobos/downloads","issues_url":"https://api.github.com/repos/D-Programming-Language/phobos/issues{/number}","pulls_url":"https://api.github.com/repos/D-Programming-Language/phobos/pulls{/number}","milestones_url":"https://api.github.com/repos/D-Programming-Language/phobos/milestones{/number}","notifications_url":"https://api.github.com/repos/D-Programming-Language/phobos/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/D-Programming-Language/phobos/labels{/name}","releases_url":"https://api.github.com/repos/D-Programming-Language/phobos/releases{/id}","created_at":"2011-01-15T07:00:06Z","updated_at":"2015-01-21T17:16:32Z","pushed_at":"2015-01-21T17:16:32Z","git_url":"git://github.com/D-Programming-Language/phobos.git","ssh_url":"git@github.com:D-Programming-Language/phobos.git","clone_url":"https://github.com/D-Programming-Language/phobos.git","svn_url":"https://github.com/D-Programming-Language/phobos","homepage":"dlang.org/phobos","size":63537,"stargazers_count":554,"watchers_count":554,"language":"D","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":367,"mirror_url":null,"open_issues_count":42,"forks":367,"open_issues":42,"watchers":554,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/D-Programming-Language/phobos/pulls/2724"},"html":{"href":"https://github.com/D-Programming-Language/phobos/pull/2724"},"issue":{"href":"https://api.github.com/repos/D-Programming-Language/phobos/issues/2724"},"comments":{"href":"https://api.github.com/repos/D-Programming-Language/phobos/issues/2724/comments"},"review_comments":{"href":"https://api.github.com/repos/D-Programming-Language/phobos/pulls/2724/comments"},"review_comment":{"href":"https://api.github.com/repos/D-Programming-Language/phobos/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/D-Programming-Language/phobos/pulls/2724/commits"},"statuses":{"href":"https://api.github.com/repos/D-Programming-Language/phobos/statuses/fed78d36926f959ee6239ba775ce882ada73ca35"}}}}