{"action":"created","comment":{"url":"https://api.github.com/repos/lotus/router/pulls/comments/46832689","id":46832689,"diff_hunk":"@@ -3,13 +3,32 @@\n module Lotus\n   module Routing\n     module Parsing\n+      # Json parsing error\n+      # This is raised when the json parser fails to parse a json string.\n+      #\n+      # @since x.x.x\n+      class BodyParsingError < ::StandardError\n+      end\n+\n       class JsonParser < Parser\n         def mime_types\n           ['application/json', 'application/vnd.api+json']\n         end\n \n+\n+        # Parse a json string\n+        #\n+        # @param body [String] a json string\n+        #\n+        # @return [Hash] the parsed json\n+        #\n+        # @raise [BodyParsingError] when the body can't be parsed.","path":"lib/lotus/routing/parsing/json_parser.rb","position":23,"original_position":23,"commit_id":"b8f37241ca55bac64385c82ebb0ad6d6c664afe9","original_commit_id":"b8f37241ca55bac64385c82ebb0ad6d6c664afe9","user":{"login":"jodosha","id":5089,"avatar_url":"https://avatars.githubusercontent.com/u/5089?v=3","gravatar_id":"","url":"https://api.github.com/users/jodosha","html_url":"https://github.com/jodosha","followers_url":"https://api.github.com/users/jodosha/followers","following_url":"https://api.github.com/users/jodosha/following{/other_user}","gists_url":"https://api.github.com/users/jodosha/gists{/gist_id}","starred_url":"https://api.github.com/users/jodosha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jodosha/subscriptions","organizations_url":"https://api.github.com/users/jodosha/orgs","repos_url":"https://api.github.com/users/jodosha/repos","events_url":"https://api.github.com/users/jodosha/events{/privacy}","received_events_url":"https://api.github.com/users/jodosha/received_events","type":"User","site_admin":false},"body":"`Lotus::Routing::Parsing::BodyParsingError` :wink: ","created_at":"2015-12-07T15:27:35Z","updated_at":"2015-12-07T15:27:35Z","html_url":"https://github.com/lotus/router/pull/77#discussion_r46832689","pull_request_url":"https://api.github.com/repos/lotus/router/pulls/77","_links":{"self":{"href":"https://api.github.com/repos/lotus/router/pulls/comments/46832689"},"html":{"href":"https://github.com/lotus/router/pull/77#discussion_r46832689"},"pull_request":{"href":"https://api.github.com/repos/lotus/router/pulls/77"}}},"pull_request":{"url":"https://api.github.com/repos/lotus/router/pulls/77","id":52778722,"html_url":"https://github.com/lotus/router/pull/77","diff_url":"https://github.com/lotus/router/pull/77.diff","patch_url":"https://github.com/lotus/router/pull/77.patch","issue_url":"https://api.github.com/repos/lotus/router/issues/77","number":77,"state":"open","locked":false,"title":"Custom lotus parser json exception","user":{"login":"AlfonsoUceda","id":925961,"avatar_url":"https://avatars.githubusercontent.com/u/925961?v=3","gravatar_id":"","url":"https://api.github.com/users/AlfonsoUceda","html_url":"https://github.com/AlfonsoUceda","followers_url":"https://api.github.com/users/AlfonsoUceda/followers","following_url":"https://api.github.com/users/AlfonsoUceda/following{/other_user}","gists_url":"https://api.github.com/users/AlfonsoUceda/gists{/gist_id}","starred_url":"https://api.github.com/users/AlfonsoUceda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlfonsoUceda/subscriptions","organizations_url":"https://api.github.com/users/AlfonsoUceda/orgs","repos_url":"https://api.github.com/users/AlfonsoUceda/repos","events_url":"https://api.github.com/users/AlfonsoUceda/events{/privacy}","received_events_url":"https://api.github.com/users/AlfonsoUceda/received_events","type":"User","site_admin":false},"body":"This PR resolves #46 \r\n\r\nRaise a custom lotus exception when the json parser fails to parse a malformed json.\r\n\r\nIf you have to implement a middleware to rescue json parser errors raised from lotus json parser, you can rescue `Lotus::Routing::Parsing::JsonParsingException` exception instead `JSON::ParseError` exception.\r\n\r\ncc @lotus/core-team ","created_at":"2015-12-06T12:08:07Z","updated_at":"2015-12-07T15:27:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bab532df740f1c5879d286fd32bef8e009440d6e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/lotus/router/pulls/77/commits","review_comments_url":"https://api.github.com/repos/lotus/router/pulls/77/comments","review_comment_url":"https://api.github.com/repos/lotus/router/pulls/comments{/number}","comments_url":"https://api.github.com/repos/lotus/router/issues/77/comments","statuses_url":"https://api.github.com/repos/lotus/router/statuses/b8f37241ca55bac64385c82ebb0ad6d6c664afe9","head":{"label":"AlfonsoUceda:rescue_json_parser_exception","ref":"rescue_json_parser_exception","sha":"b8f37241ca55bac64385c82ebb0ad6d6c664afe9","user":{"login":"AlfonsoUceda","id":925961,"avatar_url":"https://avatars.githubusercontent.com/u/925961?v=3","gravatar_id":"","url":"https://api.github.com/users/AlfonsoUceda","html_url":"https://github.com/AlfonsoUceda","followers_url":"https://api.github.com/users/AlfonsoUceda/followers","following_url":"https://api.github.com/users/AlfonsoUceda/following{/other_user}","gists_url":"https://api.github.com/users/AlfonsoUceda/gists{/gist_id}","starred_url":"https://api.github.com/users/AlfonsoUceda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlfonsoUceda/subscriptions","organizations_url":"https://api.github.com/users/AlfonsoUceda/orgs","repos_url":"https://api.github.com/users/AlfonsoUceda/repos","events_url":"https://api.github.com/users/AlfonsoUceda/events{/privacy}","received_events_url":"https://api.github.com/users/AlfonsoUceda/received_events","type":"User","site_admin":false},"repo":{"id":27304669,"name":"router","full_name":"AlfonsoUceda/router","owner":{"login":"AlfonsoUceda","id":925961,"avatar_url":"https://avatars.githubusercontent.com/u/925961?v=3","gravatar_id":"","url":"https://api.github.com/users/AlfonsoUceda","html_url":"https://github.com/AlfonsoUceda","followers_url":"https://api.github.com/users/AlfonsoUceda/followers","following_url":"https://api.github.com/users/AlfonsoUceda/following{/other_user}","gists_url":"https://api.github.com/users/AlfonsoUceda/gists{/gist_id}","starred_url":"https://api.github.com/users/AlfonsoUceda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlfonsoUceda/subscriptions","organizations_url":"https://api.github.com/users/AlfonsoUceda/orgs","repos_url":"https://api.github.com/users/AlfonsoUceda/repos","events_url":"https://api.github.com/users/AlfonsoUceda/events{/privacy}","received_events_url":"https://api.github.com/users/AlfonsoUceda/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/AlfonsoUceda/router","description":"Ruby HTTP router for Lotus","fork":true,"url":"https://api.github.com/repos/AlfonsoUceda/router","forks_url":"https://api.github.com/repos/AlfonsoUceda/router/forks","keys_url":"https://api.github.com/repos/AlfonsoUceda/router/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AlfonsoUceda/router/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AlfonsoUceda/router/teams","hooks_url":"https://api.github.com/repos/AlfonsoUceda/router/hooks","issue_events_url":"https://api.github.com/repos/AlfonsoUceda/router/issues/events{/number}","events_url":"https://api.github.com/repos/AlfonsoUceda/router/events","assignees_url":"https://api.github.com/repos/AlfonsoUceda/router/assignees{/user}","branches_url":"https://api.github.com/repos/AlfonsoUceda/router/branches{/branch}","tags_url":"https://api.github.com/repos/AlfonsoUceda/router/tags","blobs_url":"https://api.github.com/repos/AlfonsoUceda/router/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AlfonsoUceda/router/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AlfonsoUceda/router/git/refs{/sha}","trees_url":"https://api.github.com/repos/AlfonsoUceda/router/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AlfonsoUceda/router/statuses/{sha}","languages_url":"https://api.github.com/repos/AlfonsoUceda/router/languages","stargazers_url":"https://api.github.com/repos/AlfonsoUceda/router/stargazers","contributors_url":"https://api.github.com/repos/AlfonsoUceda/router/contributors","subscribers_url":"https://api.github.com/repos/AlfonsoUceda/router/subscribers","subscription_url":"https://api.github.com/repos/AlfonsoUceda/router/subscription","commits_url":"https://api.github.com/repos/AlfonsoUceda/router/commits{/sha}","git_commits_url":"https://api.github.com/repos/AlfonsoUceda/router/git/commits{/sha}","comments_url":"https://api.github.com/repos/AlfonsoUceda/router/comments{/number}","issue_comment_url":"https://api.github.com/repos/AlfonsoUceda/router/issues/comments{/number}","contents_url":"https://api.github.com/repos/AlfonsoUceda/router/contents/{+path}","compare_url":"https://api.github.com/repos/AlfonsoUceda/router/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AlfonsoUceda/router/merges","archive_url":"https://api.github.com/repos/AlfonsoUceda/router/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AlfonsoUceda/router/downloads","issues_url":"https://api.github.com/repos/AlfonsoUceda/router/issues{/number}","pulls_url":"https://api.github.com/repos/AlfonsoUceda/router/pulls{/number}","milestones_url":"https://api.github.com/repos/AlfonsoUceda/router/milestones{/number}","notifications_url":"https://api.github.com/repos/AlfonsoUceda/router/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AlfonsoUceda/router/labels{/name}","releases_url":"https://api.github.com/repos/AlfonsoUceda/router/releases{/id}","created_at":"2014-11-29T14:35:55Z","updated_at":"2015-03-24T15:31:45Z","pushed_at":"2015-12-07T14:24:52Z","git_url":"git://github.com/AlfonsoUceda/router.git","ssh_url":"git@github.com:AlfonsoUceda/router.git","clone_url":"https://github.com/AlfonsoUceda/router.git","svn_url":"https://github.com/AlfonsoUceda/router","homepage":"http://lotusrb.org","size":326,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"lotus:master","ref":"master","sha":"6bd764e247fb81e1e6ece24433642ed37d85e6af","user":{"login":"lotus","id":3210273,"avatar_url":"https://avatars.githubusercontent.com/u/3210273?v=3","gravatar_id":"","url":"https://api.github.com/users/lotus","html_url":"https://github.com/lotus","followers_url":"https://api.github.com/users/lotus/followers","following_url":"https://api.github.com/users/lotus/following{/other_user}","gists_url":"https://api.github.com/users/lotus/gists{/gist_id}","starred_url":"https://api.github.com/users/lotus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lotus/subscriptions","organizations_url":"https://api.github.com/users/lotus/orgs","repos_url":"https://api.github.com/users/lotus/repos","events_url":"https://api.github.com/users/lotus/events{/privacy}","received_events_url":"https://api.github.com/users/lotus/received_events","type":"Organization","site_admin":false},"repo":{"id":10696882,"name":"router","full_name":"lotus/router","owner":{"login":"lotus","id":3210273,"avatar_url":"https://avatars.githubusercontent.com/u/3210273?v=3","gravatar_id":"","url":"https://api.github.com/users/lotus","html_url":"https://github.com/lotus","followers_url":"https://api.github.com/users/lotus/followers","following_url":"https://api.github.com/users/lotus/following{/other_user}","gists_url":"https://api.github.com/users/lotus/gists{/gist_id}","starred_url":"https://api.github.com/users/lotus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lotus/subscriptions","organizations_url":"https://api.github.com/users/lotus/orgs","repos_url":"https://api.github.com/users/lotus/repos","events_url":"https://api.github.com/users/lotus/events{/privacy}","received_events_url":"https://api.github.com/users/lotus/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/lotus/router","description":"Ruby HTTP router for Lotus","fork":false,"url":"https://api.github.com/repos/lotus/router","forks_url":"https://api.github.com/repos/lotus/router/forks","keys_url":"https://api.github.com/repos/lotus/router/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lotus/router/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lotus/router/teams","hooks_url":"https://api.github.com/repos/lotus/router/hooks","issue_events_url":"https://api.github.com/repos/lotus/router/issues/events{/number}","events_url":"https://api.github.com/repos/lotus/router/events","assignees_url":"https://api.github.com/repos/lotus/router/assignees{/user}","branches_url":"https://api.github.com/repos/lotus/router/branches{/branch}","tags_url":"https://api.github.com/repos/lotus/router/tags","blobs_url":"https://api.github.com/repos/lotus/router/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lotus/router/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lotus/router/git/refs{/sha}","trees_url":"https://api.github.com/repos/lotus/router/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lotus/router/statuses/{sha}","languages_url":"https://api.github.com/repos/lotus/router/languages","stargazers_url":"https://api.github.com/repos/lotus/router/stargazers","contributors_url":"https://api.github.com/repos/lotus/router/contributors","subscribers_url":"https://api.github.com/repos/lotus/router/subscribers","subscription_url":"https://api.github.com/repos/lotus/router/subscription","commits_url":"https://api.github.com/repos/lotus/router/commits{/sha}","git_commits_url":"https://api.github.com/repos/lotus/router/git/commits{/sha}","comments_url":"https://api.github.com/repos/lotus/router/comments{/number}","issue_comment_url":"https://api.github.com/repos/lotus/router/issues/comments{/number}","contents_url":"https://api.github.com/repos/lotus/router/contents/{+path}","compare_url":"https://api.github.com/repos/lotus/router/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lotus/router/merges","archive_url":"https://api.github.com/repos/lotus/router/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lotus/router/downloads","issues_url":"https://api.github.com/repos/lotus/router/issues{/number}","pulls_url":"https://api.github.com/repos/lotus/router/pulls{/number}","milestones_url":"https://api.github.com/repos/lotus/router/milestones{/number}","notifications_url":"https://api.github.com/repos/lotus/router/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lotus/router/labels{/name}","releases_url":"https://api.github.com/repos/lotus/router/releases{/id}","created_at":"2013-06-14T20:07:26Z","updated_at":"2015-11-28T22:22:51Z","pushed_at":"2015-12-07T14:24:52Z","git_url":"git://github.com/lotus/router.git","ssh_url":"git@github.com:lotus/router.git","clone_url":"https://github.com/lotus/router.git","svn_url":"https://github.com/lotus/router","homepage":"http://lotusrb.org","size":353,"stargazers_count":224,"watchers_count":224,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":47,"mirror_url":null,"open_issues_count":3,"forks":47,"open_issues":3,"watchers":224,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/lotus/router/pulls/77"},"html":{"href":"https://github.com/lotus/router/pull/77"},"issue":{"href":"https://api.github.com/repos/lotus/router/issues/77"},"comments":{"href":"https://api.github.com/repos/lotus/router/issues/77/comments"},"review_comments":{"href":"https://api.github.com/repos/lotus/router/pulls/77/comments"},"review_comment":{"href":"https://api.github.com/repos/lotus/router/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/lotus/router/pulls/77/commits"},"statuses":{"href":"https://api.github.com/repos/lotus/router/statuses/b8f37241ca55bac64385c82ebb0ad6d6c664afe9"}}}}