{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/29234","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/29234/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/29234/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/29234/events","html_url":"https://github.com/rust-lang/rust/issues/29234","id":112827615,"number":29234,"title":"Document how to best write examples that use try for error handling","user":{"login":"killercup","id":20063,"avatar_url":"https://avatars.githubusercontent.com/u/20063?v=3","gravatar_id":"","url":"https://api.github.com/users/killercup","html_url":"https://github.com/killercup","followers_url":"https://api.github.com/users/killercup/followers","following_url":"https://api.github.com/users/killercup/following{/other_user}","gists_url":"https://api.github.com/users/killercup/gists{/gist_id}","starred_url":"https://api.github.com/users/killercup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/killercup/subscriptions","organizations_url":"https://api.github.com/users/killercup/orgs","repos_url":"https://api.github.com/users/killercup/repos","events_url":"https://api.github.com/users/killercup/events{/privacy}","received_events_url":"https://api.github.com/users/killercup/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rust-lang/rust/labels/A-book","name":"A-book","color":"d7e102"},{"url":"https://api.github.com/repos/rust-lang/rust/labels/A-docs","name":"A-docs","color":"d7e102"},{"url":"https://api.github.com/repos/rust-lang/rust/labels/E-easy","name":"E-easy","color":"02e10c"},{"url":"https://api.github.com/repos/rust-lang/rust/labels/E-mentor","name":"E-mentor","color":"02E10C"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-10-22T15:24:31Z","updated_at":"2015-10-28T10:36:22Z","closed_at":null,"body":"@steveklabnik wrote [on reddit](https://www.reddit.com/r/rust/comments/3pn25i/should_unwrap_be_banned_or_discouraged/cw8uo15?context=3), this this is a common style in `std`:\r\n\r\n    /// A doc test using `try!`:\r\n    ///\r\n    /// ```\r\n    /// # fn f() -> io::Result<()> {\r\n    /// let x = try!(package.open()); // danger, might explode\r\n    /// x.insert(\"valuables\", 42)\r\n    /// try!(x.close_and_reactivate());\r\n    /// # Ok(())\r\n    /// # }\r\n    /// # f();\r\n    /// ```\r\n\r\nWe should add that to the [documentation chapter of TRPL](https://doc.rust-lang.org/nightly/book/documentation.html) and maybe also to the docs of `try!`."},"comment":{"url":"https://api.github.com/repos/rust-lang/rust/issues/comments/151795842","html_url":"https://github.com/rust-lang/rust/issues/29234#issuecomment-151795842","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/29234","id":151795842,"user":{"login":"efindlay","id":14294649,"avatar_url":"https://avatars.githubusercontent.com/u/14294649?v=3","gravatar_id":"","url":"https://api.github.com/users/efindlay","html_url":"https://github.com/efindlay","followers_url":"https://api.github.com/users/efindlay/followers","following_url":"https://api.github.com/users/efindlay/following{/other_user}","gists_url":"https://api.github.com/users/efindlay/gists{/gist_id}","starred_url":"https://api.github.com/users/efindlay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/efindlay/subscriptions","organizations_url":"https://api.github.com/users/efindlay/orgs","repos_url":"https://api.github.com/users/efindlay/repos","events_url":"https://api.github.com/users/efindlay/events{/privacy}","received_events_url":"https://api.github.com/users/efindlay/received_events","type":"User","site_admin":false},"created_at":"2015-10-28T10:36:21Z","updated_at":"2015-10-28T10:36:21Z","body":"I reduced the example to one try! Maybe its better to have two try! s. I'm not sure."}}