{"action":"created","comment":{"url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/pulls/comments/27915659","id":27915659,"diff_hunk":"@@ -38,8 +38,10 @@ Stream.prototype.handle = function () {\n       this.capable = false\n     }\n   } else if (this.xhr.readyState === 4) {\n-    if (this.xhr.error) {\n-      this.emit('error')\n+    if (this.xhr.status >= 400) {\n+      var e = new Error(this.xhr.statusText || this.xhr.status)\n+      e.status = this.xhr.status\n+      this.emit('error', e)","path":"index.js","position":9,"original_position":9,"commit_id":"2b9ac0ff50e6feac25fa4d0f79068f612ea0ec3b","original_commit_id":"2b9ac0ff50e6feac25fa4d0f79068f612ea0ec3b","user":{"login":"mattsgarlata","id":1598200,"avatar_url":"https://avatars.githubusercontent.com/u/1598200?v=3","gravatar_id":"","url":"https://api.github.com/users/mattsgarlata","html_url":"https://github.com/mattsgarlata","followers_url":"https://api.github.com/users/mattsgarlata/followers","following_url":"https://api.github.com/users/mattsgarlata/following{/other_user}","gists_url":"https://api.github.com/users/mattsgarlata/gists{/gist_id}","starred_url":"https://api.github.com/users/mattsgarlata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattsgarlata/subscriptions","organizations_url":"https://api.github.com/users/mattsgarlata/orgs","repos_url":"https://api.github.com/users/mattsgarlata/repos","events_url":"https://api.github.com/users/mattsgarlata/events{/privacy}","received_events_url":"https://api.github.com/users/mattsgarlata/received_events","type":"User","site_admin":false},"body":"I think it could make sense to attach the xhr to the error so that it is available when an error occurrs.  Thoughts?","created_at":"2015-04-07T20:17:35Z","updated_at":"2015-04-07T20:17:35Z","html_url":"https://github.com/SpiderStrategies/node-buffered-xhr-stream/pull/5#discussion_r27915659","pull_request_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/pulls/5","_links":{"self":{"href":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/pulls/comments/27915659"},"html":{"href":"https://github.com/SpiderStrategies/node-buffered-xhr-stream/pull/5#discussion_r27915659"},"pull_request":{"href":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/pulls/5"}}},"pull_request":{"url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/pulls/5","id":32800986,"html_url":"https://github.com/SpiderStrategies/node-buffered-xhr-stream/pull/5","diff_url":"https://github.com/SpiderStrategies/node-buffered-xhr-stream/pull/5.diff","patch_url":"https://github.com/SpiderStrategies/node-buffered-xhr-stream/pull/5.patch","issue_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/issues/5","number":5,"state":"open","locked":false,"title":"emit http errors","user":{"login":"jerryorr","id":1598167,"avatar_url":"https://avatars.githubusercontent.com/u/1598167?v=3","gravatar_id":"","url":"https://api.github.com/users/jerryorr","html_url":"https://github.com/jerryorr","followers_url":"https://api.github.com/users/jerryorr/followers","following_url":"https://api.github.com/users/jerryorr/following{/other_user}","gists_url":"https://api.github.com/users/jerryorr/gists{/gist_id}","starred_url":"https://api.github.com/users/jerryorr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jerryorr/subscriptions","organizations_url":"https://api.github.com/users/jerryorr/orgs","repos_url":"https://api.github.com/users/jerryorr/repos","events_url":"https://api.github.com/users/jerryorr/events{/privacy}","received_events_url":"https://api.github.com/users/jerryorr/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-04-07T20:14:53Z","updated_at":"2015-04-07T20:17:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b3bbed06f87afa633ad0ed69684262b79a68efdc","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/pulls/5/commits","review_comments_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/pulls/5/comments","review_comment_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/pulls/comments{/number}","comments_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/issues/5/comments","statuses_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/statuses/2b9ac0ff50e6feac25fa4d0f79068f612ea0ec3b","head":{"label":"SpiderStrategies:emit-errors","ref":"emit-errors","sha":"2b9ac0ff50e6feac25fa4d0f79068f612ea0ec3b","user":{"login":"SpiderStrategies","id":1259401,"avatar_url":"https://avatars.githubusercontent.com/u/1259401?v=3","gravatar_id":"","url":"https://api.github.com/users/SpiderStrategies","html_url":"https://github.com/SpiderStrategies","followers_url":"https://api.github.com/users/SpiderStrategies/followers","following_url":"https://api.github.com/users/SpiderStrategies/following{/other_user}","gists_url":"https://api.github.com/users/SpiderStrategies/gists{/gist_id}","starred_url":"https://api.github.com/users/SpiderStrategies/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SpiderStrategies/subscriptions","organizations_url":"https://api.github.com/users/SpiderStrategies/orgs","repos_url":"https://api.github.com/users/SpiderStrategies/repos","events_url":"https://api.github.com/users/SpiderStrategies/events{/privacy}","received_events_url":"https://api.github.com/users/SpiderStrategies/received_events","type":"Organization","site_admin":false},"repo":{"id":20787543,"name":"node-buffered-xhr-stream","full_name":"SpiderStrategies/node-buffered-xhr-stream","owner":{"login":"SpiderStrategies","id":1259401,"avatar_url":"https://avatars.githubusercontent.com/u/1259401?v=3","gravatar_id":"","url":"https://api.github.com/users/SpiderStrategies","html_url":"https://github.com/SpiderStrategies","followers_url":"https://api.github.com/users/SpiderStrategies/followers","following_url":"https://api.github.com/users/SpiderStrategies/following{/other_user}","gists_url":"https://api.github.com/users/SpiderStrategies/gists{/gist_id}","starred_url":"https://api.github.com/users/SpiderStrategies/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SpiderStrategies/subscriptions","organizations_url":"https://api.github.com/users/SpiderStrategies/orgs","repos_url":"https://api.github.com/users/SpiderStrategies/repos","events_url":"https://api.github.com/users/SpiderStrategies/events{/privacy}","received_events_url":"https://api.github.com/users/SpiderStrategies/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SpiderStrategies/node-buffered-xhr-stream","description":"A pausable/resumable xhr stream","fork":false,"url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream","forks_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/forks","keys_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/teams","hooks_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/hooks","issue_events_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/issues/events{/number}","events_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/events","assignees_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/assignees{/user}","branches_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/branches{/branch}","tags_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/tags","blobs_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/git/refs{/sha}","trees_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/statuses/{sha}","languages_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/languages","stargazers_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/stargazers","contributors_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/contributors","subscribers_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/subscribers","subscription_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/subscription","commits_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/commits{/sha}","git_commits_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/git/commits{/sha}","comments_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/comments{/number}","issue_comment_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/issues/comments{/number}","contents_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/contents/{+path}","compare_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/merges","archive_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/downloads","issues_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/issues{/number}","pulls_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/pulls{/number}","milestones_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/milestones{/number}","notifications_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/labels{/name}","releases_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/releases{/id}","created_at":"2014-06-13T00:45:00Z","updated_at":"2014-06-18T15:50:46Z","pushed_at":"2015-04-07T20:14:53Z","git_url":"git://github.com/SpiderStrategies/node-buffered-xhr-stream.git","ssh_url":"git@github.com:SpiderStrategies/node-buffered-xhr-stream.git","clone_url":"https://github.com/SpiderStrategies/node-buffered-xhr-stream.git","svn_url":"https://github.com/SpiderStrategies/node-buffered-xhr-stream","homepage":null,"size":224,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"SpiderStrategies:master","ref":"master","sha":"a39891eeb56c1870f525e0afb57bc54c462ab024","user":{"login":"SpiderStrategies","id":1259401,"avatar_url":"https://avatars.githubusercontent.com/u/1259401?v=3","gravatar_id":"","url":"https://api.github.com/users/SpiderStrategies","html_url":"https://github.com/SpiderStrategies","followers_url":"https://api.github.com/users/SpiderStrategies/followers","following_url":"https://api.github.com/users/SpiderStrategies/following{/other_user}","gists_url":"https://api.github.com/users/SpiderStrategies/gists{/gist_id}","starred_url":"https://api.github.com/users/SpiderStrategies/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SpiderStrategies/subscriptions","organizations_url":"https://api.github.com/users/SpiderStrategies/orgs","repos_url":"https://api.github.com/users/SpiderStrategies/repos","events_url":"https://api.github.com/users/SpiderStrategies/events{/privacy}","received_events_url":"https://api.github.com/users/SpiderStrategies/received_events","type":"Organization","site_admin":false},"repo":{"id":20787543,"name":"node-buffered-xhr-stream","full_name":"SpiderStrategies/node-buffered-xhr-stream","owner":{"login":"SpiderStrategies","id":1259401,"avatar_url":"https://avatars.githubusercontent.com/u/1259401?v=3","gravatar_id":"","url":"https://api.github.com/users/SpiderStrategies","html_url":"https://github.com/SpiderStrategies","followers_url":"https://api.github.com/users/SpiderStrategies/followers","following_url":"https://api.github.com/users/SpiderStrategies/following{/other_user}","gists_url":"https://api.github.com/users/SpiderStrategies/gists{/gist_id}","starred_url":"https://api.github.com/users/SpiderStrategies/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SpiderStrategies/subscriptions","organizations_url":"https://api.github.com/users/SpiderStrategies/orgs","repos_url":"https://api.github.com/users/SpiderStrategies/repos","events_url":"https://api.github.com/users/SpiderStrategies/events{/privacy}","received_events_url":"https://api.github.com/users/SpiderStrategies/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SpiderStrategies/node-buffered-xhr-stream","description":"A pausable/resumable xhr stream","fork":false,"url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream","forks_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/forks","keys_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/teams","hooks_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/hooks","issue_events_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/issues/events{/number}","events_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/events","assignees_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/assignees{/user}","branches_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/branches{/branch}","tags_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/tags","blobs_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/git/refs{/sha}","trees_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/statuses/{sha}","languages_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/languages","stargazers_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/stargazers","contributors_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/contributors","subscribers_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/subscribers","subscription_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/subscription","commits_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/commits{/sha}","git_commits_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/git/commits{/sha}","comments_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/comments{/number}","issue_comment_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/issues/comments{/number}","contents_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/contents/{+path}","compare_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/merges","archive_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/downloads","issues_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/issues{/number}","pulls_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/pulls{/number}","milestones_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/milestones{/number}","notifications_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/labels{/name}","releases_url":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/releases{/id}","created_at":"2014-06-13T00:45:00Z","updated_at":"2014-06-18T15:50:46Z","pushed_at":"2015-04-07T20:14:53Z","git_url":"git://github.com/SpiderStrategies/node-buffered-xhr-stream.git","ssh_url":"git@github.com:SpiderStrategies/node-buffered-xhr-stream.git","clone_url":"https://github.com/SpiderStrategies/node-buffered-xhr-stream.git","svn_url":"https://github.com/SpiderStrategies/node-buffered-xhr-stream","homepage":null,"size":224,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/pulls/5"},"html":{"href":"https://github.com/SpiderStrategies/node-buffered-xhr-stream/pull/5"},"issue":{"href":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/issues/5"},"comments":{"href":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/pulls/5/comments"},"review_comment":{"href":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/SpiderStrategies/node-buffered-xhr-stream/statuses/2b9ac0ff50e6feac25fa4d0f79068f612ea0ec3b"}}}}