{"action":"closed","issue":{"url":"https://api.github.com/repos/uiri/SEGIMAP/issues/15","repository_url":"https://api.github.com/repos/uiri/SEGIMAP","labels_url":"https://api.github.com/repos/uiri/SEGIMAP/issues/15/labels{/name}","comments_url":"https://api.github.com/repos/uiri/SEGIMAP/issues/15/comments","events_url":"https://api.github.com/repos/uiri/SEGIMAP/issues/15/events","html_url":"https://github.com/uiri/SEGIMAP/issues/15","id":60753296,"number":15,"title":"Implement Proper Error Handling","user":{"login":"indiv0","id":641547,"avatar_url":"https://avatars0.githubusercontent.com/u/641547?v=3","gravatar_id":"","url":"https://api.github.com/users/indiv0","html_url":"https://github.com/indiv0","followers_url":"https://api.github.com/users/indiv0/followers","following_url":"https://api.github.com/users/indiv0/following{/other_user}","gists_url":"https://api.github.com/users/indiv0/gists{/gist_id}","starred_url":"https://api.github.com/users/indiv0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/indiv0/subscriptions","organizations_url":"https://api.github.com/users/indiv0/orgs","repos_url":"https://api.github.com/users/indiv0/repos","events_url":"https://api.github.com/users/indiv0/events{/privacy}","received_events_url":"https://api.github.com/users/indiv0/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2015-03-12T00:31:54Z","updated_at":"2017-05-19T04:40:16Z","closed_at":"2017-05-19T04:40:16Z","body":"Per the discussion in #3, simply using `unwrap()` on all `Result`s and `Option`s isn't good practice or very sustainable, in terms of code-debt.\n\nCurrently, our preferred error-handling system is to use our own `Error` struct by using `match` statements to manually unwrap values and wrap external errors in our custom `Error` type.\n\nThis results in overly verbose statements and (occaisionally) repeated code for error wrapping.\n\nWe can reduce the necessity of said unwrappings by replacing them with the `try!` macro.\nThis can be done by implementing the `FromError` trait for our custom error type.\n\nAdditonally, per the [error docs](https://doc.rust-lang.org/std/error/index.html), error messages should be handled by the `Display` trait.\n\nAs such, it is probably best to remove the `desc` field from our `Error` struct and handle error messages via an implementation of the `Display` trait.\n\nHowever, in that scenario, our `Error` struct is then only a custom implementation of the standard `Error` trait described in the the [error chaining RFC](https://github.com/rust-lang/rfcs/blob/master/text/0201-error-chaining.md) and later expanded upon in the error documentation above.\nTaking this into consideration, it's probably best to replace our `Error` struct with an `Error` enum (as seen in libraries such as [rustc-serialize](https://github.com/rust-lang/rustc-serialize/blob/master/src/json.rs)).\n\nThis is in our best interest because it removes the redundant and unnecessary `Error` struct, allows for easier error message handling (by simply adding a `string::String` parameter to the enum values which require it), and for simpler internal error representation and generation.\n# Tasks\n- [ ] Replace all instances of `unwrap` in the code\n- [x] Implement `FromError` for error types used in conjunction with the `try!` macro\n- [x] Use `try!` macro where possible to avoid verbose match trees\n- [x] Replace `Error` struct with the `ErrorKind` enum\n"}}
{"actor":{"display_login":"uiri"}}