{"action":"created","issue":{"url":"https://api.github.com/repos/servo/servo/issues/9600","repository_url":"https://api.github.com/repos/servo/servo","labels_url":"https://api.github.com/repos/servo/servo/issues/9600/labels{/name}","comments_url":"https://api.github.com/repos/servo/servo/issues/9600/comments","events_url":"https://api.github.com/repos/servo/servo/issues/9600/events","html_url":"https://github.com/servo/servo/pull/9600","id":132875796,"number":9600,"title":"Add informative error messages when parsing command line options returns an error","user":{"login":"danlrobertson","id":7504153,"avatar_url":"https://avatars.githubusercontent.com/u/7504153?v=3","gravatar_id":"","url":"https://api.github.com/users/danlrobertson","html_url":"https://github.com/danlrobertson","followers_url":"https://api.github.com/users/danlrobertson/followers","following_url":"https://api.github.com/users/danlrobertson/following{/other_user}","gists_url":"https://api.github.com/users/danlrobertson/gists{/gist_id}","starred_url":"https://api.github.com/users/danlrobertson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danlrobertson/subscriptions","organizations_url":"https://api.github.com/users/danlrobertson/orgs","repos_url":"https://api.github.com/users/danlrobertson/repos","events_url":"https://api.github.com/users/danlrobertson/events{/privacy}","received_events_url":"https://api.github.com/users/danlrobertson/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/servo/servo/labels/S-awaiting-merge","name":"S-awaiting-merge","color":"d4c5f9"}],"state":"closed","locked":false,"assignee":{"login":"ecoal95","id":1323194,"avatar_url":"https://avatars.githubusercontent.com/u/1323194?v=3","gravatar_id":"","url":"https://api.github.com/users/ecoal95","html_url":"https://github.com/ecoal95","followers_url":"https://api.github.com/users/ecoal95/followers","following_url":"https://api.github.com/users/ecoal95/following{/other_user}","gists_url":"https://api.github.com/users/ecoal95/gists{/gist_id}","starred_url":"https://api.github.com/users/ecoal95/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ecoal95/subscriptions","organizations_url":"https://api.github.com/users/ecoal95/orgs","repos_url":"https://api.github.com/users/ecoal95/repos","events_url":"https://api.github.com/users/ecoal95/events{/privacy}","received_events_url":"https://api.github.com/users/ecoal95/received_events","type":"User","site_admin":false},"milestone":null,"comments":8,"created_at":"2016-02-11T03:01:08Z","updated_at":"2016-02-16T22:02:08Z","closed_at":"2016-02-16T18:42:50Z","pull_request":{"url":"https://api.github.com/repos/servo/servo/pulls/9600","html_url":"https://github.com/servo/servo/pull/9600","diff_url":"https://github.com/servo/servo/pull/9600.diff","patch_url":"https://github.com/servo/servo/pull/9600.patch"},"body":"The background behind why I'm submitting this PR is slightly embarrassing. After running `./mach` with some servo options I got the following stack backtrace.\r\n\r\n```\r\nthread '<main>' panicked at 'called `Result::unwrap()` on an `Err` value: ParseIntError { kind: InvalidDigit }', ../src/libcore/result.rs:746\r\nstack backtrace:\r\n   1:     0x56459001b0b0 - sys::backtrace::tracing::imp::write::hb120982054a416e35nu\r\n   2:     0x56459001e02b - panicking::default_handler::_$u7b$$u7b$closure$u7d$$u7d$::closure.42840\r\n   3:     0x56459001dc96 - panicking::default_handler::h7ae2e4523ef4c187IFy\r\n   4:     0x56459000760c - sys_common::unwind::begin_unwind_inner::h5fb19481d14902dbDgt\r\n   5:     0x564590007cf8 - sys_common::unwind::begin_unwind_fmt::hd62d57279546b0f2Jft\r\n   6:     0x56459001a701 - rust_begin_unwind\r\n   7:     0x56459004c01f - panicking::panic_fmt::h27f7225e08792f40qYL\r\n   8:     0x56458f393901 - result::unwrap_failed::h18215968003310890981\r\n                        at ../src/libcore/macros.rs:29\r\n   9:     0x56458f3937b9 - result::Result<T, E>::unwrap::h10319050269194353824\r\n                        at ../src/libcore/result.rs:687\r\n  10:     0x56458f383701 - opts::from_cmdline_args::h8ea8d8c87dc6ee726lg\r\n                        at /home/drobertson/git/servo/components/util/opts.rs:599\r\n  11:     0x56458d1f8cdf - main::h8517eb49d15e90fbNaa\r\n                        at /home/drobertson/git/servo/components/servo/main.rs:53\r\n  12:     0x56459001d8f4 - sys_common::unwind::try::try_fn::h9076850075504893162\r\n  13:     0x56459001a68b - __rust_try\r\n  14:     0x56459001d36e - rt::lang_start::h58a22f304b0c1e19Oxy\r\n  15:     0x56458d2f4aa9 - main\r\n  16:     0x7f370496360f - __libc_start_main\r\n  17:     0x56458d1c04a8 - _start\r\n  18:                0x0 - <unknown>\r\nServo exited with return value 101\r\n```\r\n\r\nI immediately opened up `gdb` and got to work only to realize that the error was due to a typo in an option that had been `unwrap`ed at [components/util/opts.rs:599](https://github.com/servo/servo/blob/master/components/util/opts.rs#L599). Perhaps some more informative error messages will help prevent some future face-palm moments like mine :smile:\r\n\r\nI couldn't think of a good way to add tests for this. Please let me know if I missed something. Comments and critiques are welcome!\n\n<!-- Reviewable:start -->\n[<img src=\"https://reviewable.io/review_button.svg\" height=\"40\" alt=\"Review on Reviewable\"/>](https://reviewable.io/reviews/servo/servo/9600)\n<!-- Reviewable:end -->\n"},"comment":{"url":"https://api.github.com/repos/servo/servo/issues/comments/184892474","html_url":"https://github.com/servo/servo/pull/9600#issuecomment-184892474","issue_url":"https://api.github.com/repos/servo/servo/issues/9600","id":184892474,"user":{"login":"danlrobertson","id":7504153,"avatar_url":"https://avatars.githubusercontent.com/u/7504153?v=3","gravatar_id":"","url":"https://api.github.com/users/danlrobertson","html_url":"https://github.com/danlrobertson","followers_url":"https://api.github.com/users/danlrobertson/followers","following_url":"https://api.github.com/users/danlrobertson/following{/other_user}","gists_url":"https://api.github.com/users/danlrobertson/gists{/gist_id}","starred_url":"https://api.github.com/users/danlrobertson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danlrobertson/subscriptions","organizations_url":"https://api.github.com/users/danlrobertson/orgs","repos_url":"https://api.github.com/users/danlrobertson/repos","events_url":"https://api.github.com/users/danlrobertson/events{/privacy}","received_events_url":"https://api.github.com/users/danlrobertson/received_events","type":"User","site_admin":false},"created_at":"2016-02-16T22:02:08Z","updated_at":"2016-02-16T22:02:08Z","body":"No worries!"}}