{"action":"created","comment":{"url":"https://api.github.com/repos/ReactiveX/rxjs/pulls/comments/88810167","pull_request_review_id":9372024,"id":88810167,"diff_hunk":"@@ -20,7 +20,8 @@ export function timeout<T>(this: Observable<T>, due: number | Date,\n                            scheduler: Scheduler = async): Observable<T> {\n   const absoluteTimeout = isDate(due);\n   const waitFor = absoluteTimeout ? (+due - scheduler.now()) : Math.abs(<number>due);\n-  const error = errorToSend || new TimeoutError();\n+  const error = errorToSend instanceof Error ? errorToSend : new TimeoutError(errorToSend);","path":"src/operator/timeout.ts","position":5,"original_position":5,"commit_id":"e4f33f4fde5c59f1ad11549eec91ff85244b6cd8","original_commit_id":"e4f33f4fde5c59f1ad11549eec91ff85244b6cd8","user":{"login":"jayphelps","id":762949,"avatar_url":"https://avatars.githubusercontent.com/u/762949?v=3","gravatar_id":"","url":"https://api.github.com/users/jayphelps","html_url":"https://github.com/jayphelps","followers_url":"https://api.github.com/users/jayphelps/followers","following_url":"https://api.github.com/users/jayphelps/following{/other_user}","gists_url":"https://api.github.com/users/jayphelps/gists{/gist_id}","starred_url":"https://api.github.com/users/jayphelps/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jayphelps/subscriptions","organizations_url":"https://api.github.com/users/jayphelps/orgs","repos_url":"https://api.github.com/users/jayphelps/repos","events_url":"https://api.github.com/users/jayphelps/events{/privacy}","received_events_url":"https://api.github.com/users/jayphelps/received_events","type":"User","site_admin":false},"body":"I don't fully understand the use case for providing an error **instance**. Why would you want to do `.timeout(10, new SomeError())`? Instead, wouldn't you really want to pass the class itself, to be instantiated _when_ there is an error? `.timeout(10, SomeError)`? IMO that (along with the overload of providing just a string) is the more ideal API.","created_at":"2016-11-20T20:17:15Z","updated_at":"2016-11-20T20:17:15Z","html_url":"https://github.com/ReactiveX/rxjs/pull/2141#discussion_r88810167","pull_request_url":"https://api.github.com/repos/ReactiveX/rxjs/pulls/2141","_links":{"self":{"href":"https://api.github.com/repos/ReactiveX/rxjs/pulls/comments/88810167"},"html":{"href":"https://github.com/ReactiveX/rxjs/pull/2141#discussion_r88810167"},"pull_request":{"href":"https://api.github.com/repos/ReactiveX/rxjs/pulls/2141"}}},"pull_request":{"url":"https://api.github.com/repos/ReactiveX/rxjs/pulls/2141","id":94318558,"html_url":"https://github.com/ReactiveX/rxjs/pull/2141","diff_url":"https://github.com/ReactiveX/rxjs/pull/2141.diff","patch_url":"https://github.com/ReactiveX/rxjs/pull/2141.patch","issue_url":"https://api.github.com/repos/ReactiveX/rxjs/issues/2141","number":2141,"state":"open","locked":false,"title":"fix(timeout): wrap customError with TimeoutError","user":{"login":"kwonoj","id":1210596,"avatar_url":"https://avatars.githubusercontent.com/u/1210596?v=3","gravatar_id":"","url":"https://api.github.com/users/kwonoj","html_url":"https://github.com/kwonoj","followers_url":"https://api.github.com/users/kwonoj/followers","following_url":"https://api.github.com/users/kwonoj/following{/other_user}","gists_url":"https://api.github.com/users/kwonoj/gists{/gist_id}","starred_url":"https://api.github.com/users/kwonoj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kwonoj/subscriptions","organizations_url":"https://api.github.com/users/kwonoj/orgs","repos_url":"https://api.github.com/users/kwonoj/repos","events_url":"https://api.github.com/users/kwonoj/events{/privacy}","received_events_url":"https://api.github.com/users/kwonoj/received_events","type":"User","site_admin":false},"body":"<!--\r\nThank you very much for your pull request!\r\n\r\nIf your PR is the addition of a new operator, please make sure all these boxes are ticked with an x:\r\n\r\n- [ ] Add the operator to Rx\r\n- [ ] It must have a `-spec.ts` tests file covering the canonical corner cases, with marble diagram tests\r\n- [ ] If possible, write a `asDiagram` test case too, for PNG diagram generation purposes\r\n- [ ] The spec file should have a type definition test at the end of the spec to verify type definition for various use cases\r\n- [ ] The operator must be documented in JSDoc style in the implementation file, including also the PNG marble diagram image\r\n- [ ] The operator should be listed in `doc/operators.md` in a category of operators\r\n- [ ] It should also be inserted in the operator decision tree file `doc/decision-tree-widget/tree.yml`\r\n- [ ] You may need to update `MIGRATION.md` if the operator differs from the corresponding one in RxJS v4\r\n-->\r\n\r\n**Description:**\r\n\r\nThis PR updates behavior of `timeout` when specify `errorToSend` for custom timeout message. Since custom timeout message can be anything (literally `any`), if caller does not specify it as timeouterror, when it's thrown it does not deliver context of error thrown. This PR checks type of error, wraps into timeout error to have additional context to debug. \r\n\r\nwith given example snippet\r\n`Rx.Observable.never().timeout(10, 'customerr').subscribe(console.log.bind(console));`\r\n\r\n*Before*\r\n```js\r\nD:\\github\\rxjs\\dist\\cjs\\scheduler\\AsyncScheduler.js:45\r\n            throw error;\r\n            ^\r\ncustomerr\r\n```\r\n\r\n*After*\r\n```js\r\nD:\\github\\rxjs\\dist\\cjs\\scheduler\\AsyncScheduler.js:45\r\n            throw error;\r\n            ^\r\nTimeoutError: customerr\r\n    at new TimeoutError (D:\\github\\rxjs\\dist\\cjs\\util\\TimeoutError.js:17:26)\r\n    at NeverObservable.timeout (D:\\github\\rxjs\\dist\\cjs\\operator\\timeout.js:30:17)\r\n    at Object.<anonymous> (D:\\github\\rxjs\\dummy.js:3:23)\r\n    at Module._compile (module.js:573:32)\r\n    at Object.Module._extensions..js (module.js:582:10)\r\n    at Module.load (module.js:490:32)\r\n    at tryModuleLoad (module.js:449:12)\r\n    at Function.Module._load (module.js:441:3)\r\n    at Module.runMain (module.js:607:10)\r\n    at run (bootstrap_node.js:382:7)\r\n```\r\n\r\n**Related issue (if exists):**\r\n\r\n","created_at":"2016-11-18T08:06:26Z","updated_at":"2016-11-20T20:17:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e9f6719317cbf40c2147e58fe47b36b9a41f75db","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/ReactiveX/rxjs/pulls/2141/commits","review_comments_url":"https://api.github.com/repos/ReactiveX/rxjs/pulls/2141/comments","review_comment_url":"https://api.github.com/repos/ReactiveX/rxjs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ReactiveX/rxjs/issues/2141/comments","statuses_url":"https://api.github.com/repos/ReactiveX/rxjs/statuses/e4f33f4fde5c59f1ad11549eec91ff85244b6cd8","head":{"label":"kwonoj:fix-timeout-customerr","ref":"fix-timeout-customerr","sha":"e4f33f4fde5c59f1ad11549eec91ff85244b6cd8","user":{"login":"kwonoj","id":1210596,"avatar_url":"https://avatars.githubusercontent.com/u/1210596?v=3","gravatar_id":"","url":"https://api.github.com/users/kwonoj","html_url":"https://github.com/kwonoj","followers_url":"https://api.github.com/users/kwonoj/followers","following_url":"https://api.github.com/users/kwonoj/following{/other_user}","gists_url":"https://api.github.com/users/kwonoj/gists{/gist_id}","starred_url":"https://api.github.com/users/kwonoj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kwonoj/subscriptions","organizations_url":"https://api.github.com/users/kwonoj/orgs","repos_url":"https://api.github.com/users/kwonoj/repos","events_url":"https://api.github.com/users/kwonoj/events{/privacy}","received_events_url":"https://api.github.com/users/kwonoj/received_events","type":"User","site_admin":false},"repo":{"id":41501851,"name":"RxJS","full_name":"kwonoj/RxJS","owner":{"login":"kwonoj","id":1210596,"avatar_url":"https://avatars.githubusercontent.com/u/1210596?v=3","gravatar_id":"","url":"https://api.github.com/users/kwonoj","html_url":"https://github.com/kwonoj","followers_url":"https://api.github.com/users/kwonoj/followers","following_url":"https://api.github.com/users/kwonoj/following{/other_user}","gists_url":"https://api.github.com/users/kwonoj/gists{/gist_id}","starred_url":"https://api.github.com/users/kwonoj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kwonoj/subscriptions","organizations_url":"https://api.github.com/users/kwonoj/orgs","repos_url":"https://api.github.com/users/kwonoj/repos","events_url":"https://api.github.com/users/kwonoj/events{/privacy}","received_events_url":"https://api.github.com/users/kwonoj/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kwonoj/RxJS","description":"A reactive programming library for JavaScript","fork":true,"url":"https://api.github.com/repos/kwonoj/RxJS","forks_url":"https://api.github.com/repos/kwonoj/RxJS/forks","keys_url":"https://api.github.com/repos/kwonoj/RxJS/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kwonoj/RxJS/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kwonoj/RxJS/teams","hooks_url":"https://api.github.com/repos/kwonoj/RxJS/hooks","issue_events_url":"https://api.github.com/repos/kwonoj/RxJS/issues/events{/number}","events_url":"https://api.github.com/repos/kwonoj/RxJS/events","assignees_url":"https://api.github.com/repos/kwonoj/RxJS/assignees{/user}","branches_url":"https://api.github.com/repos/kwonoj/RxJS/branches{/branch}","tags_url":"https://api.github.com/repos/kwonoj/RxJS/tags","blobs_url":"https://api.github.com/repos/kwonoj/RxJS/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kwonoj/RxJS/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kwonoj/RxJS/git/refs{/sha}","trees_url":"https://api.github.com/repos/kwonoj/RxJS/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kwonoj/RxJS/statuses/{sha}","languages_url":"https://api.github.com/repos/kwonoj/RxJS/languages","stargazers_url":"https://api.github.com/repos/kwonoj/RxJS/stargazers","contributors_url":"https://api.github.com/repos/kwonoj/RxJS/contributors","subscribers_url":"https://api.github.com/repos/kwonoj/RxJS/subscribers","subscription_url":"https://api.github.com/repos/kwonoj/RxJS/subscription","commits_url":"https://api.github.com/repos/kwonoj/RxJS/commits{/sha}","git_commits_url":"https://api.github.com/repos/kwonoj/RxJS/git/commits{/sha}","comments_url":"https://api.github.com/repos/kwonoj/RxJS/comments{/number}","issue_comment_url":"https://api.github.com/repos/kwonoj/RxJS/issues/comments{/number}","contents_url":"https://api.github.com/repos/kwonoj/RxJS/contents/{+path}","compare_url":"https://api.github.com/repos/kwonoj/RxJS/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kwonoj/RxJS/merges","archive_url":"https://api.github.com/repos/kwonoj/RxJS/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kwonoj/RxJS/downloads","issues_url":"https://api.github.com/repos/kwonoj/RxJS/issues{/number}","pulls_url":"https://api.github.com/repos/kwonoj/RxJS/pulls{/number}","milestones_url":"https://api.github.com/repos/kwonoj/RxJS/milestones{/number}","notifications_url":"https://api.github.com/repos/kwonoj/RxJS/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kwonoj/RxJS/labels{/name}","releases_url":"https://api.github.com/repos/kwonoj/RxJS/releases{/id}","deployments_url":"https://api.github.com/repos/kwonoj/RxJS/deployments","created_at":"2015-08-27T17:41:24Z","updated_at":"2016-03-01T17:53:11Z","pushed_at":"2016-11-18T13:23:26Z","git_url":"git://github.com/kwonoj/RxJS.git","ssh_url":"git@github.com:kwonoj/RxJS.git","clone_url":"https://github.com/kwonoj/RxJS.git","svn_url":"https://github.com/kwonoj/RxJS","homepage":null,"size":6364,"stargazers_count":0,"watchers_count":0,"language":"TypeScript","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"ReactiveX:master","ref":"master","sha":"6cf7296089adfacec0942e67031718ad78aae95e","user":{"login":"ReactiveX","id":6407041,"avatar_url":"https://avatars.githubusercontent.com/u/6407041?v=3","gravatar_id":"","url":"https://api.github.com/users/ReactiveX","html_url":"https://github.com/ReactiveX","followers_url":"https://api.github.com/users/ReactiveX/followers","following_url":"https://api.github.com/users/ReactiveX/following{/other_user}","gists_url":"https://api.github.com/users/ReactiveX/gists{/gist_id}","starred_url":"https://api.github.com/users/ReactiveX/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ReactiveX/subscriptions","organizations_url":"https://api.github.com/users/ReactiveX/orgs","repos_url":"https://api.github.com/users/ReactiveX/repos","events_url":"https://api.github.com/users/ReactiveX/events{/privacy}","received_events_url":"https://api.github.com/users/ReactiveX/received_events","type":"Organization","site_admin":false},"repo":{"id":32247847,"name":"rxjs","full_name":"ReactiveX/rxjs","owner":{"login":"ReactiveX","id":6407041,"avatar_url":"https://avatars.githubusercontent.com/u/6407041?v=3","gravatar_id":"","url":"https://api.github.com/users/ReactiveX","html_url":"https://github.com/ReactiveX","followers_url":"https://api.github.com/users/ReactiveX/followers","following_url":"https://api.github.com/users/ReactiveX/following{/other_user}","gists_url":"https://api.github.com/users/ReactiveX/gists{/gist_id}","starred_url":"https://api.github.com/users/ReactiveX/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ReactiveX/subscriptions","organizations_url":"https://api.github.com/users/ReactiveX/orgs","repos_url":"https://api.github.com/users/ReactiveX/repos","events_url":"https://api.github.com/users/ReactiveX/events{/privacy}","received_events_url":"https://api.github.com/users/ReactiveX/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ReactiveX/rxjs","description":"A reactive programming library for JavaScript","fork":false,"url":"https://api.github.com/repos/ReactiveX/rxjs","forks_url":"https://api.github.com/repos/ReactiveX/rxjs/forks","keys_url":"https://api.github.com/repos/ReactiveX/rxjs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ReactiveX/rxjs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ReactiveX/rxjs/teams","hooks_url":"https://api.github.com/repos/ReactiveX/rxjs/hooks","issue_events_url":"https://api.github.com/repos/ReactiveX/rxjs/issues/events{/number}","events_url":"https://api.github.com/repos/ReactiveX/rxjs/events","assignees_url":"https://api.github.com/repos/ReactiveX/rxjs/assignees{/user}","branches_url":"https://api.github.com/repos/ReactiveX/rxjs/branches{/branch}","tags_url":"https://api.github.com/repos/ReactiveX/rxjs/tags","blobs_url":"https://api.github.com/repos/ReactiveX/rxjs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ReactiveX/rxjs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ReactiveX/rxjs/git/refs{/sha}","trees_url":"https://api.github.com/repos/ReactiveX/rxjs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ReactiveX/rxjs/statuses/{sha}","languages_url":"https://api.github.com/repos/ReactiveX/rxjs/languages","stargazers_url":"https://api.github.com/repos/ReactiveX/rxjs/stargazers","contributors_url":"https://api.github.com/repos/ReactiveX/rxjs/contributors","subscribers_url":"https://api.github.com/repos/ReactiveX/rxjs/subscribers","subscription_url":"https://api.github.com/repos/ReactiveX/rxjs/subscription","commits_url":"https://api.github.com/repos/ReactiveX/rxjs/commits{/sha}","git_commits_url":"https://api.github.com/repos/ReactiveX/rxjs/git/commits{/sha}","comments_url":"https://api.github.com/repos/ReactiveX/rxjs/comments{/number}","issue_comment_url":"https://api.github.com/repos/ReactiveX/rxjs/issues/comments{/number}","contents_url":"https://api.github.com/repos/ReactiveX/rxjs/contents/{+path}","compare_url":"https://api.github.com/repos/ReactiveX/rxjs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ReactiveX/rxjs/merges","archive_url":"https://api.github.com/repos/ReactiveX/rxjs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ReactiveX/rxjs/downloads","issues_url":"https://api.github.com/repos/ReactiveX/rxjs/issues{/number}","pulls_url":"https://api.github.com/repos/ReactiveX/rxjs/pulls{/number}","milestones_url":"https://api.github.com/repos/ReactiveX/rxjs/milestones{/number}","notifications_url":"https://api.github.com/repos/ReactiveX/rxjs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ReactiveX/rxjs/labels{/name}","releases_url":"https://api.github.com/repos/ReactiveX/rxjs/releases{/id}","deployments_url":"https://api.github.com/repos/ReactiveX/rxjs/deployments","created_at":"2015-03-15T06:17:10Z","updated_at":"2016-11-20T20:14:54Z","pushed_at":"2016-11-20T04:36:22Z","git_url":"git://github.com/ReactiveX/rxjs.git","ssh_url":"git@github.com:ReactiveX/rxjs.git","clone_url":"https://github.com/ReactiveX/rxjs.git","svn_url":"https://github.com/ReactiveX/rxjs","homepage":"http://reactivex.io/rxjs","size":58457,"stargazers_count":3925,"watchers_count":3925,"language":"TypeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":354,"mirror_url":null,"open_issues_count":132,"forks":354,"open_issues":132,"watchers":3925,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ReactiveX/rxjs/pulls/2141"},"html":{"href":"https://github.com/ReactiveX/rxjs/pull/2141"},"issue":{"href":"https://api.github.com/repos/ReactiveX/rxjs/issues/2141"},"comments":{"href":"https://api.github.com/repos/ReactiveX/rxjs/issues/2141/comments"},"review_comments":{"href":"https://api.github.com/repos/ReactiveX/rxjs/pulls/2141/comments"},"review_comment":{"href":"https://api.github.com/repos/ReactiveX/rxjs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ReactiveX/rxjs/pulls/2141/commits"},"statuses":{"href":"https://api.github.com/repos/ReactiveX/rxjs/statuses/e4f33f4fde5c59f1ad11549eec91ff85244b6cd8"}}}}
{"actor":{"display_login":"jayphelps"}}