{"action":"created","comment":{"url":"https://api.github.com/repos/cloudant/couchbackup/pulls/comments/120344394","pull_request_review_id":42298022,"id":120344394,"diff_hunk":"@@ -322,3 +322,25 @@ describe('Event tests', function() {\n     });\n   });\n });\n+\n+describe('Write error tests', function() {\n+  it('calls callback with error set when stream is not writeable', function(done) {\n+    u.timeoutFilter(this, 10);\n+    const dirname = fs.mkdtempSync('test_backup');\n+    // make temp dir not writeable\n+    fs.chmodSync(dirname, 0);\n+    const filename = dirname + '/test.backup';\n+    const backupStream = fs.createWriteStream(filename, {flags: 'w'});\n+    const params = {useApi: true};\n+    // try to do backup and check err was set in callback\n+    u.testBackup(params, 'animaldb', backupStream, function(err) {\n+      // error should have been set\n+      assert.ok(err != null);\n+      assert.equal(err.code, 'EACCES');\n+      // cleanup temp dir","path":"citest/test.js","position":19,"original_position":19,"commit_id":"29edb57c57611a147088a8288da8c86bcab03bae","original_commit_id":"29edb57c57611a147088a8288da8c86bcab03bae","user":{"login":"ricellis","id":10698320,"avatar_url":"https://avatars3.githubusercontent.com/u/10698320?v=3","gravatar_id":"","url":"https://api.github.com/users/ricellis","html_url":"https://github.com/ricellis","followers_url":"https://api.github.com/users/ricellis/followers","following_url":"https://api.github.com/users/ricellis/following{/other_user}","gists_url":"https://api.github.com/users/ricellis/gists{/gist_id}","starred_url":"https://api.github.com/users/ricellis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ricellis/subscriptions","organizations_url":"https://api.github.com/users/ricellis/orgs","repos_url":"https://api.github.com/users/ricellis/repos","events_url":"https://api.github.com/users/ricellis/events{/privacy}","received_events_url":"https://api.github.com/users/ricellis/received_events","type":"User","site_admin":false},"body":"The asserts will throw if they fail which will cause an `uncaught` exception in the tests.\r\nThis style worked more cleanly for me and made sure that the after hooks etc were not interrupted.\r\n```js\r\ntry {\r\n  assert ...\r\n  done()\r\n} catch (err) {\r\n  done(err);\r\n}\r\n```\r\nYou will also probably want to move the cleanup before the asserts, otherwise it won't run in cases where the test fails.","created_at":"2017-06-06T12:33:16Z","updated_at":"2017-06-06T12:34:12Z","html_url":"https://github.com/cloudant/couchbackup/pull/95#discussion_r120344394","pull_request_url":"https://api.github.com/repos/cloudant/couchbackup/pulls/95","_links":{"self":{"href":"https://api.github.com/repos/cloudant/couchbackup/pulls/comments/120344394"},"html":{"href":"https://github.com/cloudant/couchbackup/pull/95#discussion_r120344394"},"pull_request":{"href":"https://api.github.com/repos/cloudant/couchbackup/pulls/95"}}},"pull_request":{"url":"https://api.github.com/repos/cloudant/couchbackup/pulls/95","id":123978394,"html_url":"https://github.com/cloudant/couchbackup/pull/95","diff_url":"https://github.com/cloudant/couchbackup/pull/95.diff","patch_url":"https://github.com/cloudant/couchbackup/pull/95.patch","issue_url":"https://api.github.com/repos/cloudant/couchbackup/issues/95","number":95,"state":"open","locked":false,"title":"Throw error when write fails","user":{"login":"tomblench","id":6302842,"avatar_url":"https://avatars0.githubusercontent.com/u/6302842?v=3","gravatar_id":"","url":"https://api.github.com/users/tomblench","html_url":"https://github.com/tomblench","followers_url":"https://api.github.com/users/tomblench/followers","following_url":"https://api.github.com/users/tomblench/following{/other_user}","gists_url":"https://api.github.com/users/tomblench/gists{/gist_id}","starred_url":"https://api.github.com/users/tomblench/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomblench/subscriptions","organizations_url":"https://api.github.com/users/tomblench/orgs","repos_url":"https://api.github.com/users/tomblench/repos","events_url":"https://api.github.com/users/tomblench/events{/privacy}","received_events_url":"https://api.github.com/users/tomblench/received_events","type":"User","site_admin":false},"body":"Related to #61, this PR addresses cases where we're writing to a stream and not a file, so it's not possible to check if it is writable before starting. Instead, make sure that the callback is called with the correct error","created_at":"2017-06-05T13:36:19Z","updated_at":"2017-06-06T12:34:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"02f5a7da9bb5b94c969b2abf4b1db6f555f51f27","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":{"url":"https://api.github.com/repos/cloudant/couchbackup/milestones/1","html_url":"https://github.com/cloudant/couchbackup/milestone/1","labels_url":"https://api.github.com/repos/cloudant/couchbackup/milestones/1/labels","id":2484101,"number":1,"title":"2.0","description":"","creator":{"login":"ricellis","id":10698320,"avatar_url":"https://avatars3.githubusercontent.com/u/10698320?v=3","gravatar_id":"","url":"https://api.github.com/users/ricellis","html_url":"https://github.com/ricellis","followers_url":"https://api.github.com/users/ricellis/followers","following_url":"https://api.github.com/users/ricellis/following{/other_user}","gists_url":"https://api.github.com/users/ricellis/gists{/gist_id}","starred_url":"https://api.github.com/users/ricellis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ricellis/subscriptions","organizations_url":"https://api.github.com/users/ricellis/orgs","repos_url":"https://api.github.com/users/ricellis/repos","events_url":"https://api.github.com/users/ricellis/events{/privacy}","received_events_url":"https://api.github.com/users/ricellis/received_events","type":"User","site_admin":false},"open_issues":10,"closed_issues":82,"state":"open","created_at":"2017-04-26T16:22:17Z","updated_at":"2017-06-06T12:30:01Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/cloudant/couchbackup/pulls/95/commits","review_comments_url":"https://api.github.com/repos/cloudant/couchbackup/pulls/95/comments","review_comment_url":"https://api.github.com/repos/cloudant/couchbackup/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cloudant/couchbackup/issues/95/comments","statuses_url":"https://api.github.com/repos/cloudant/couchbackup/statuses/29edb57c57611a147088a8288da8c86bcab03bae","head":{"label":"cloudant:61-throw-error-on-writes","ref":"61-throw-error-on-writes","sha":"29edb57c57611a147088a8288da8c86bcab03bae","user":{"login":"cloudant","id":44642,"avatar_url":"https://avatars3.githubusercontent.com/u/44642?v=3","gravatar_id":"","url":"https://api.github.com/users/cloudant","html_url":"https://github.com/cloudant","followers_url":"https://api.github.com/users/cloudant/followers","following_url":"https://api.github.com/users/cloudant/following{/other_user}","gists_url":"https://api.github.com/users/cloudant/gists{/gist_id}","starred_url":"https://api.github.com/users/cloudant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloudant/subscriptions","organizations_url":"https://api.github.com/users/cloudant/orgs","repos_url":"https://api.github.com/users/cloudant/repos","events_url":"https://api.github.com/users/cloudant/events{/privacy}","received_events_url":"https://api.github.com/users/cloudant/received_events","type":"Organization","site_admin":false},"repo":{"id":87912220,"name":"couchbackup","full_name":"cloudant/couchbackup","owner":{"login":"cloudant","id":44642,"avatar_url":"https://avatars3.githubusercontent.com/u/44642?v=3","gravatar_id":"","url":"https://api.github.com/users/cloudant","html_url":"https://github.com/cloudant","followers_url":"https://api.github.com/users/cloudant/followers","following_url":"https://api.github.com/users/cloudant/following{/other_user}","gists_url":"https://api.github.com/users/cloudant/gists{/gist_id}","starred_url":"https://api.github.com/users/cloudant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloudant/subscriptions","organizations_url":"https://api.github.com/users/cloudant/orgs","repos_url":"https://api.github.com/users/cloudant/repos","events_url":"https://api.github.com/users/cloudant/events{/privacy}","received_events_url":"https://api.github.com/users/cloudant/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cloudant/couchbackup","description":"Cloudant backup and restore library and command-line utility","fork":false,"url":"https://api.github.com/repos/cloudant/couchbackup","forks_url":"https://api.github.com/repos/cloudant/couchbackup/forks","keys_url":"https://api.github.com/repos/cloudant/couchbackup/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cloudant/couchbackup/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cloudant/couchbackup/teams","hooks_url":"https://api.github.com/repos/cloudant/couchbackup/hooks","issue_events_url":"https://api.github.com/repos/cloudant/couchbackup/issues/events{/number}","events_url":"https://api.github.com/repos/cloudant/couchbackup/events","assignees_url":"https://api.github.com/repos/cloudant/couchbackup/assignees{/user}","branches_url":"https://api.github.com/repos/cloudant/couchbackup/branches{/branch}","tags_url":"https://api.github.com/repos/cloudant/couchbackup/tags","blobs_url":"https://api.github.com/repos/cloudant/couchbackup/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cloudant/couchbackup/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cloudant/couchbackup/git/refs{/sha}","trees_url":"https://api.github.com/repos/cloudant/couchbackup/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cloudant/couchbackup/statuses/{sha}","languages_url":"https://api.github.com/repos/cloudant/couchbackup/languages","stargazers_url":"https://api.github.com/repos/cloudant/couchbackup/stargazers","contributors_url":"https://api.github.com/repos/cloudant/couchbackup/contributors","subscribers_url":"https://api.github.com/repos/cloudant/couchbackup/subscribers","subscription_url":"https://api.github.com/repos/cloudant/couchbackup/subscription","commits_url":"https://api.github.com/repos/cloudant/couchbackup/commits{/sha}","git_commits_url":"https://api.github.com/repos/cloudant/couchbackup/git/commits{/sha}","comments_url":"https://api.github.com/repos/cloudant/couchbackup/comments{/number}","issue_comment_url":"https://api.github.com/repos/cloudant/couchbackup/issues/comments{/number}","contents_url":"https://api.github.com/repos/cloudant/couchbackup/contents/{+path}","compare_url":"https://api.github.com/repos/cloudant/couchbackup/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cloudant/couchbackup/merges","archive_url":"https://api.github.com/repos/cloudant/couchbackup/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cloudant/couchbackup/downloads","issues_url":"https://api.github.com/repos/cloudant/couchbackup/issues{/number}","pulls_url":"https://api.github.com/repos/cloudant/couchbackup/pulls{/number}","milestones_url":"https://api.github.com/repos/cloudant/couchbackup/milestones{/number}","notifications_url":"https://api.github.com/repos/cloudant/couchbackup/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cloudant/couchbackup/labels{/name}","releases_url":"https://api.github.com/repos/cloudant/couchbackup/releases{/id}","deployments_url":"https://api.github.com/repos/cloudant/couchbackup/deployments","created_at":"2017-04-11T08:55:36Z","updated_at":"2017-06-06T09:40:59Z","pushed_at":"2017-06-06T12:32:06Z","git_url":"git://github.com/cloudant/couchbackup.git","ssh_url":"git@github.com:cloudant/couchbackup.git","clone_url":"https://github.com/cloudant/couchbackup.git","svn_url":"https://github.com/cloudant/couchbackup","homepage":null,"size":172,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":17,"forks":0,"open_issues":17,"watchers":0,"default_branch":"master"}},"base":{"label":"cloudant:master","ref":"master","sha":"93a8c88f6e8d8f29af9a660577519dc894024f5d","user":{"login":"cloudant","id":44642,"avatar_url":"https://avatars3.githubusercontent.com/u/44642?v=3","gravatar_id":"","url":"https://api.github.com/users/cloudant","html_url":"https://github.com/cloudant","followers_url":"https://api.github.com/users/cloudant/followers","following_url":"https://api.github.com/users/cloudant/following{/other_user}","gists_url":"https://api.github.com/users/cloudant/gists{/gist_id}","starred_url":"https://api.github.com/users/cloudant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloudant/subscriptions","organizations_url":"https://api.github.com/users/cloudant/orgs","repos_url":"https://api.github.com/users/cloudant/repos","events_url":"https://api.github.com/users/cloudant/events{/privacy}","received_events_url":"https://api.github.com/users/cloudant/received_events","type":"Organization","site_admin":false},"repo":{"id":87912220,"name":"couchbackup","full_name":"cloudant/couchbackup","owner":{"login":"cloudant","id":44642,"avatar_url":"https://avatars3.githubusercontent.com/u/44642?v=3","gravatar_id":"","url":"https://api.github.com/users/cloudant","html_url":"https://github.com/cloudant","followers_url":"https://api.github.com/users/cloudant/followers","following_url":"https://api.github.com/users/cloudant/following{/other_user}","gists_url":"https://api.github.com/users/cloudant/gists{/gist_id}","starred_url":"https://api.github.com/users/cloudant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloudant/subscriptions","organizations_url":"https://api.github.com/users/cloudant/orgs","repos_url":"https://api.github.com/users/cloudant/repos","events_url":"https://api.github.com/users/cloudant/events{/privacy}","received_events_url":"https://api.github.com/users/cloudant/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cloudant/couchbackup","description":"Cloudant backup and restore library and command-line utility","fork":false,"url":"https://api.github.com/repos/cloudant/couchbackup","forks_url":"https://api.github.com/repos/cloudant/couchbackup/forks","keys_url":"https://api.github.com/repos/cloudant/couchbackup/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cloudant/couchbackup/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cloudant/couchbackup/teams","hooks_url":"https://api.github.com/repos/cloudant/couchbackup/hooks","issue_events_url":"https://api.github.com/repos/cloudant/couchbackup/issues/events{/number}","events_url":"https://api.github.com/repos/cloudant/couchbackup/events","assignees_url":"https://api.github.com/repos/cloudant/couchbackup/assignees{/user}","branches_url":"https://api.github.com/repos/cloudant/couchbackup/branches{/branch}","tags_url":"https://api.github.com/repos/cloudant/couchbackup/tags","blobs_url":"https://api.github.com/repos/cloudant/couchbackup/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cloudant/couchbackup/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cloudant/couchbackup/git/refs{/sha}","trees_url":"https://api.github.com/repos/cloudant/couchbackup/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cloudant/couchbackup/statuses/{sha}","languages_url":"https://api.github.com/repos/cloudant/couchbackup/languages","stargazers_url":"https://api.github.com/repos/cloudant/couchbackup/stargazers","contributors_url":"https://api.github.com/repos/cloudant/couchbackup/contributors","subscribers_url":"https://api.github.com/repos/cloudant/couchbackup/subscribers","subscription_url":"https://api.github.com/repos/cloudant/couchbackup/subscription","commits_url":"https://api.github.com/repos/cloudant/couchbackup/commits{/sha}","git_commits_url":"https://api.github.com/repos/cloudant/couchbackup/git/commits{/sha}","comments_url":"https://api.github.com/repos/cloudant/couchbackup/comments{/number}","issue_comment_url":"https://api.github.com/repos/cloudant/couchbackup/issues/comments{/number}","contents_url":"https://api.github.com/repos/cloudant/couchbackup/contents/{+path}","compare_url":"https://api.github.com/repos/cloudant/couchbackup/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cloudant/couchbackup/merges","archive_url":"https://api.github.com/repos/cloudant/couchbackup/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cloudant/couchbackup/downloads","issues_url":"https://api.github.com/repos/cloudant/couchbackup/issues{/number}","pulls_url":"https://api.github.com/repos/cloudant/couchbackup/pulls{/number}","milestones_url":"https://api.github.com/repos/cloudant/couchbackup/milestones{/number}","notifications_url":"https://api.github.com/repos/cloudant/couchbackup/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cloudant/couchbackup/labels{/name}","releases_url":"https://api.github.com/repos/cloudant/couchbackup/releases{/id}","deployments_url":"https://api.github.com/repos/cloudant/couchbackup/deployments","created_at":"2017-04-11T08:55:36Z","updated_at":"2017-06-06T09:40:59Z","pushed_at":"2017-06-06T12:32:06Z","git_url":"git://github.com/cloudant/couchbackup.git","ssh_url":"git@github.com:cloudant/couchbackup.git","clone_url":"https://github.com/cloudant/couchbackup.git","svn_url":"https://github.com/cloudant/couchbackup","homepage":null,"size":172,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":17,"forks":0,"open_issues":17,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cloudant/couchbackup/pulls/95"},"html":{"href":"https://github.com/cloudant/couchbackup/pull/95"},"issue":{"href":"https://api.github.com/repos/cloudant/couchbackup/issues/95"},"comments":{"href":"https://api.github.com/repos/cloudant/couchbackup/issues/95/comments"},"review_comments":{"href":"https://api.github.com/repos/cloudant/couchbackup/pulls/95/comments"},"review_comment":{"href":"https://api.github.com/repos/cloudant/couchbackup/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cloudant/couchbackup/pulls/95/commits"},"statuses":{"href":"https://api.github.com/repos/cloudant/couchbackup/statuses/29edb57c57611a147088a8288da8c86bcab03bae"}}}}
{"actor":{"display_login":"ricellis"}}