{"action":"created","comment":{"url":"https://api.github.com/repos/lotus/model/pulls/comments/49891071","id":49891071,"diff_hunk":"@@ -55,10 +59,41 @@ def update(entity)\n           # @api private\n           # @since 0.1.0\n           def delete\n-            @collection.delete\n+            _rescue_database_error do\n+              @collection.delete\n+            end\n           end\n \n           alias_method :clear, :delete\n+\n+          private\n+\n+          # Rescues Sequel::DatabaseError in yielded block\n+          #\n+          # @api private\n+          def _rescue_database_error\n+            yield\n+          rescue Sequel::DatabaseError => e\n+            raise _transform_database_error(e)","path":"lib/lotus/model/adapters/sql/command.rb","position":42,"original_position":42,"commit_id":"1db52737f0a3c00964f73ba7e94e1f7433b9c6f8","original_commit_id":"1db52737f0a3c00964f73ba7e94e1f7433b9c6f8","user":{"login":"Moratorius","id":1855061,"avatar_url":"https://avatars.githubusercontent.com/u/1855061?v=3","gravatar_id":"","url":"https://api.github.com/users/Moratorius","html_url":"https://github.com/Moratorius","followers_url":"https://api.github.com/users/Moratorius/followers","following_url":"https://api.github.com/users/Moratorius/following{/other_user}","gists_url":"https://api.github.com/users/Moratorius/gists{/gist_id}","starred_url":"https://api.github.com/users/Moratorius/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Moratorius/subscriptions","organizations_url":"https://api.github.com/users/Moratorius/orgs","repos_url":"https://api.github.com/users/Moratorius/repos","events_url":"https://api.github.com/users/Moratorius/events{/privacy}","received_events_url":"https://api.github.com/users/Moratorius/received_events","type":"User","site_admin":false},"body":"I agree, I did not know `#cause` existed.  Thanks!","created_at":"2016-01-15T19:01:41Z","updated_at":"2016-01-15T19:01:41Z","html_url":"https://github.com/lotus/model/pull/281#discussion_r49891071","pull_request_url":"https://api.github.com/repos/lotus/model/pulls/281","_links":{"self":{"href":"https://api.github.com/repos/lotus/model/pulls/comments/49891071"},"html":{"href":"https://github.com/lotus/model/pull/281#discussion_r49891071"},"pull_request":{"href":"https://api.github.com/repos/lotus/model/pulls/281"}}},"pull_request":{"url":"https://api.github.com/repos/lotus/model/pulls/281","id":56138697,"html_url":"https://github.com/lotus/model/pull/281","diff_url":"https://github.com/lotus/model/pull/281.diff","patch_url":"https://github.com/lotus/model/pull/281.patch","issue_url":"https://api.github.com/repos/lotus/model/issues/281","number":281,"state":"open","locked":false,"title":"Rescue and transform sequel database errors in Lotus::Command","user":{"login":"Moratorius","id":1855061,"avatar_url":"https://avatars.githubusercontent.com/u/1855061?v=3","gravatar_id":"","url":"https://api.github.com/users/Moratorius","html_url":"https://github.com/Moratorius","followers_url":"https://api.github.com/users/Moratorius/followers","following_url":"https://api.github.com/users/Moratorius/following{/other_user}","gists_url":"https://api.github.com/users/Moratorius/gists{/gist_id}","starred_url":"https://api.github.com/users/Moratorius/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Moratorius/subscriptions","organizations_url":"https://api.github.com/users/Moratorius/orgs","repos_url":"https://api.github.com/users/Moratorius/repos","events_url":"https://api.github.com/users/Moratorius/events{/privacy}","received_events_url":"https://api.github.com/users/Moratorius/received_events","type":"User","site_admin":false},"body":"When creating an entity, the SqlAdapter does not raise a Lotus::Model::Error and\r\ninstead bubbles exceptions up from the adapter.  Applications should not be\r\nconcerned with the underlying adapter implementation, so the sql adapter command\r\nhas been modified to transform sequel database errors into lotus errors.","created_at":"2016-01-15T07:30:39Z","updated_at":"2016-01-15T19:01:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8748f960ea1cc04cfe52065097c1a3aec90f6077","assignee":{"login":"joneslee85","id":135605,"avatar_url":"https://avatars.githubusercontent.com/u/135605?v=3","gravatar_id":"","url":"https://api.github.com/users/joneslee85","html_url":"https://github.com/joneslee85","followers_url":"https://api.github.com/users/joneslee85/followers","following_url":"https://api.github.com/users/joneslee85/following{/other_user}","gists_url":"https://api.github.com/users/joneslee85/gists{/gist_id}","starred_url":"https://api.github.com/users/joneslee85/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joneslee85/subscriptions","organizations_url":"https://api.github.com/users/joneslee85/orgs","repos_url":"https://api.github.com/users/joneslee85/repos","events_url":"https://api.github.com/users/joneslee85/events{/privacy}","received_events_url":"https://api.github.com/users/joneslee85/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/lotus/model/pulls/281/commits","review_comments_url":"https://api.github.com/repos/lotus/model/pulls/281/comments","review_comment_url":"https://api.github.com/repos/lotus/model/pulls/comments{/number}","comments_url":"https://api.github.com/repos/lotus/model/issues/281/comments","statuses_url":"https://api.github.com/repos/lotus/model/statuses/1db52737f0a3c00964f73ba7e94e1f7433b9c6f8","head":{"label":"Acornsgrow:lotus-errors-for-sequel-adapter","ref":"lotus-errors-for-sequel-adapter","sha":"1db52737f0a3c00964f73ba7e94e1f7433b9c6f8","user":{"login":"Acornsgrow","id":3977038,"avatar_url":"https://avatars.githubusercontent.com/u/3977038?v=3","gravatar_id":"","url":"https://api.github.com/users/Acornsgrow","html_url":"https://github.com/Acornsgrow","followers_url":"https://api.github.com/users/Acornsgrow/followers","following_url":"https://api.github.com/users/Acornsgrow/following{/other_user}","gists_url":"https://api.github.com/users/Acornsgrow/gists{/gist_id}","starred_url":"https://api.github.com/users/Acornsgrow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Acornsgrow/subscriptions","organizations_url":"https://api.github.com/users/Acornsgrow/orgs","repos_url":"https://api.github.com/users/Acornsgrow/repos","events_url":"https://api.github.com/users/Acornsgrow/events{/privacy}","received_events_url":"https://api.github.com/users/Acornsgrow/received_events","type":"Organization","site_admin":false},"repo":{"id":49522179,"name":"model","full_name":"Acornsgrow/model","owner":{"login":"Acornsgrow","id":3977038,"avatar_url":"https://avatars.githubusercontent.com/u/3977038?v=3","gravatar_id":"","url":"https://api.github.com/users/Acornsgrow","html_url":"https://github.com/Acornsgrow","followers_url":"https://api.github.com/users/Acornsgrow/followers","following_url":"https://api.github.com/users/Acornsgrow/following{/other_user}","gists_url":"https://api.github.com/users/Acornsgrow/gists{/gist_id}","starred_url":"https://api.github.com/users/Acornsgrow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Acornsgrow/subscriptions","organizations_url":"https://api.github.com/users/Acornsgrow/orgs","repos_url":"https://api.github.com/users/Acornsgrow/repos","events_url":"https://api.github.com/users/Acornsgrow/events{/privacy}","received_events_url":"https://api.github.com/users/Acornsgrow/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Acornsgrow/model","description":"A persistence framework with entities, repositories, data mapper and query objects","fork":true,"url":"https://api.github.com/repos/Acornsgrow/model","forks_url":"https://api.github.com/repos/Acornsgrow/model/forks","keys_url":"https://api.github.com/repos/Acornsgrow/model/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Acornsgrow/model/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Acornsgrow/model/teams","hooks_url":"https://api.github.com/repos/Acornsgrow/model/hooks","issue_events_url":"https://api.github.com/repos/Acornsgrow/model/issues/events{/number}","events_url":"https://api.github.com/repos/Acornsgrow/model/events","assignees_url":"https://api.github.com/repos/Acornsgrow/model/assignees{/user}","branches_url":"https://api.github.com/repos/Acornsgrow/model/branches{/branch}","tags_url":"https://api.github.com/repos/Acornsgrow/model/tags","blobs_url":"https://api.github.com/repos/Acornsgrow/model/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Acornsgrow/model/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Acornsgrow/model/git/refs{/sha}","trees_url":"https://api.github.com/repos/Acornsgrow/model/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Acornsgrow/model/statuses/{sha}","languages_url":"https://api.github.com/repos/Acornsgrow/model/languages","stargazers_url":"https://api.github.com/repos/Acornsgrow/model/stargazers","contributors_url":"https://api.github.com/repos/Acornsgrow/model/contributors","subscribers_url":"https://api.github.com/repos/Acornsgrow/model/subscribers","subscription_url":"https://api.github.com/repos/Acornsgrow/model/subscription","commits_url":"https://api.github.com/repos/Acornsgrow/model/commits{/sha}","git_commits_url":"https://api.github.com/repos/Acornsgrow/model/git/commits{/sha}","comments_url":"https://api.github.com/repos/Acornsgrow/model/comments{/number}","issue_comment_url":"https://api.github.com/repos/Acornsgrow/model/issues/comments{/number}","contents_url":"https://api.github.com/repos/Acornsgrow/model/contents/{+path}","compare_url":"https://api.github.com/repos/Acornsgrow/model/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Acornsgrow/model/merges","archive_url":"https://api.github.com/repos/Acornsgrow/model/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Acornsgrow/model/downloads","issues_url":"https://api.github.com/repos/Acornsgrow/model/issues{/number}","pulls_url":"https://api.github.com/repos/Acornsgrow/model/pulls{/number}","milestones_url":"https://api.github.com/repos/Acornsgrow/model/milestones{/number}","notifications_url":"https://api.github.com/repos/Acornsgrow/model/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Acornsgrow/model/labels{/name}","releases_url":"https://api.github.com/repos/Acornsgrow/model/releases{/id}","created_at":"2016-01-12T18:59:40Z","updated_at":"2016-01-12T18:59:41Z","pushed_at":"2016-01-15T07:29:06Z","git_url":"git://github.com/Acornsgrow/model.git","ssh_url":"git@github.com:Acornsgrow/model.git","clone_url":"https://github.com/Acornsgrow/model.git","svn_url":"https://github.com/Acornsgrow/model","homepage":"","size":824,"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":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"lotus:master","ref":"master","sha":"cfd8df38bc57afa562acb71abd3f7e822e584581","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":16760719,"name":"model","full_name":"lotus/model","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/model","description":"A persistence framework with entities, repositories, data mapper and query objects","fork":false,"url":"https://api.github.com/repos/lotus/model","forks_url":"https://api.github.com/repos/lotus/model/forks","keys_url":"https://api.github.com/repos/lotus/model/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lotus/model/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lotus/model/teams","hooks_url":"https://api.github.com/repos/lotus/model/hooks","issue_events_url":"https://api.github.com/repos/lotus/model/issues/events{/number}","events_url":"https://api.github.com/repos/lotus/model/events","assignees_url":"https://api.github.com/repos/lotus/model/assignees{/user}","branches_url":"https://api.github.com/repos/lotus/model/branches{/branch}","tags_url":"https://api.github.com/repos/lotus/model/tags","blobs_url":"https://api.github.com/repos/lotus/model/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lotus/model/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lotus/model/git/refs{/sha}","trees_url":"https://api.github.com/repos/lotus/model/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lotus/model/statuses/{sha}","languages_url":"https://api.github.com/repos/lotus/model/languages","stargazers_url":"https://api.github.com/repos/lotus/model/stargazers","contributors_url":"https://api.github.com/repos/lotus/model/contributors","subscribers_url":"https://api.github.com/repos/lotus/model/subscribers","subscription_url":"https://api.github.com/repos/lotus/model/subscription","commits_url":"https://api.github.com/repos/lotus/model/commits{/sha}","git_commits_url":"https://api.github.com/repos/lotus/model/git/commits{/sha}","comments_url":"https://api.github.com/repos/lotus/model/comments{/number}","issue_comment_url":"https://api.github.com/repos/lotus/model/issues/comments{/number}","contents_url":"https://api.github.com/repos/lotus/model/contents/{+path}","compare_url":"https://api.github.com/repos/lotus/model/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lotus/model/merges","archive_url":"https://api.github.com/repos/lotus/model/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lotus/model/downloads","issues_url":"https://api.github.com/repos/lotus/model/issues{/number}","pulls_url":"https://api.github.com/repos/lotus/model/pulls{/number}","milestones_url":"https://api.github.com/repos/lotus/model/milestones{/number}","notifications_url":"https://api.github.com/repos/lotus/model/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lotus/model/labels{/name}","releases_url":"https://api.github.com/repos/lotus/model/releases{/id}","created_at":"2014-02-12T08:25:42Z","updated_at":"2016-01-15T08:57:15Z","pushed_at":"2016-01-15T07:30:40Z","git_url":"git://github.com/lotus/model.git","ssh_url":"git@github.com:lotus/model.git","clone_url":"https://github.com/lotus/model.git","svn_url":"https://github.com/lotus/model","homepage":"","size":1202,"stargazers_count":242,"watchers_count":242,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":99,"mirror_url":null,"open_issues_count":16,"forks":99,"open_issues":16,"watchers":242,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/lotus/model/pulls/281"},"html":{"href":"https://github.com/lotus/model/pull/281"},"issue":{"href":"https://api.github.com/repos/lotus/model/issues/281"},"comments":{"href":"https://api.github.com/repos/lotus/model/issues/281/comments"},"review_comments":{"href":"https://api.github.com/repos/lotus/model/pulls/281/comments"},"review_comment":{"href":"https://api.github.com/repos/lotus/model/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/lotus/model/pulls/281/commits"},"statuses":{"href":"https://api.github.com/repos/lotus/model/statuses/1db52737f0a3c00964f73ba7e94e1f7433b9c6f8"}}}}