{"id":13438570,"url":"https://github.com/rust-cli/human-panic","last_synced_at":"2025-05-12T13:11:17.498Z","repository":{"id":37470692,"uuid":"129563456","full_name":"rust-cli/human-panic","owner":"rust-cli","description":"Panic messages for humans.","archived":false,"fork":false,"pushed_at":"2025-04-03T11:48:38.000Z","size":372,"stargazers_count":1749,"open_issues_count":16,"forks_count":67,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-04-23T15:54:24.136Z","etag":null,"topics":["human-centered-design","panic-hook","rust"],"latest_commit_sha":null,"homepage":"https://docs.rs/human-panic","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rust-cli.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-04-15T00:03:08.000Z","updated_at":"2025-04-22T08:37:57.000Z","dependencies_parsed_at":"2023-09-26T17:02:28.464Z","dependency_job_id":"d000a9dc-76bc-451a-b3ac-be538c4191c3","html_url":"https://github.com/rust-cli/human-panic","commit_stats":{"total_commits":289,"total_committers":26,"mean_commits":"11.115384615384615","dds":0.4152249134948097,"last_synced_commit":"898ff68f195bbca6949e45e93017384d724f8353"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-cli%2Fhuman-panic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-cli%2Fhuman-panic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-cli%2Fhuman-panic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-cli%2Fhuman-panic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rust-cli","download_url":"https://codeload.github.com/rust-cli/human-panic/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253745166,"owners_count":21957317,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["human-centered-design","panic-hook","rust"],"created_at":"2024-07-31T03:01:06.539Z","updated_at":"2025-05-12T13:11:17.414Z","avatar_url":"https://github.com/rust-cli.png","language":"Rust","readme":"# human-panic\n[![crates.io version][1]][2] [![build status][3]][4]\n[![downloads][5]][6] [![docs.rs docs][7]][8]\n\nPanic messages for humans. Handles panics by calling\n[`std::panic::set_hook`](https://doc.rust-lang.org/std/panic/fn.set_hook.html)\nto make errors nice for humans.\n\n- [Documentation][8]\n- [Crates.io][2]\n\n## Why?\nWhen you're building a CLI, polish is super important. Even though Rust is\npretty great at safety, it's not unheard of to access the wrong index in a\nvector or have an assert fail somewhere.\n\nWhen an error eventually occurs, you probably will want to know about it. So\ninstead of just providing an error message on the command line, we can create a\ncall to action for people to submit a report.\n\nThis should empower people to engage in communication, lowering the chances\npeople might get frustrated. And making it easier to figure out what might be\ncausing bugs.\n\n### Default Output\n\n```txt\nthread 'main' panicked at 'oops', examples/main.rs:2:3\nnote: Run with `RUST_BACKTRACE=1` for a backtrace.\n```\n\n### Human-Panic Output\n\n```txt\nWell, this is embarrassing.\n\nhuman-panic had a problem and crashed. To help us diagnose the problem you can send us a crash report.\n\nWe have generated a report file at \"/var/folders/zw/bpfvmq390lv2c6gn_6byyv0w0000gn/T/report-8351cad6-d2b5-4fe8-accd-1fcbf4538792.toml\". Submit an issue or email with the subject of \"human-panic Crash Report\" and include the report as an attachment.\n\n- Homepage: https://github.com/rust-cli/human-panic\n- Authors: Yoshua Wuyts \u003cyoshuawuyts@gmail.com\u003e\n\nWe take privacy seriously, and do not perform any automated error collection. In order to improve the software, we rely on people to submit reports.\n\nThank you kindly!\n```\n\nThe error dump file generated by `human-panic` contains the following fields.\n\n```toml\nname = 'single-panic-test'\noperating_system = 'unix:Unknown'\ncrate_version = '0.1.0'\nexplanation = '''\nCause: OMG EVERYTHING IS ON FIRE!!!. Panic occurred in file 'tests/single-panic/src/main.rs' at line 8\n'''\nmethod = 'Panic'\nbacktrace = '''\nstack backtrace:\n   0:     0x55fa0ed4c1b4 - backtrace::backtrace::libunwind::trace::h69e50feca54bfb84\n                        at /home/spacekookie/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.6/src/backtrace/libunwind.rs:53\n                         - backtrace::backtrace::trace::h42967341e0b01ccc\n                        at /home/spacekookie/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.6/src/backtrace/mod.rs:42\n    \n    # ...\n\n   8:     0x55fa0ebaac8d - single_panic_test::main::h56a3d326bcecfc36\n                        at tests/single-panic/src/main.rs:8\n   9:     0x55fa0ebaae91 - std::rt::lang_start::{{closure}}::h09d28d8540038bf8\n                        at /checkout/src/libstd/rt.rs:74\n  10:     0x55fa0ed732f7 - std::rt::lang_start_internal::{{closure}}::h2e4baf0a27c956a3\n                        at libstd/rt.rs:59\n                         - std::panicking::try::do_call::h73f98ed0647c7274\n                        at libstd/panicking.rs:305\n  11:     0x55fa0ed8551e - __rust_maybe_catch_panic\n                        at libpanic_unwind/lib.rs:101\n  12:     0x55fa0ed6f7f5 - std::panicking::try::h18fbb145180d4cd9\n                        at libstd/panicking.rs:284\n                         - std::panic::catch_unwind::hc4b6a212a30b4bc5\n                        at libstd/panic.rs:361\n                         - std::rt::lang_start_internal::h8b001b4244930d51\n                        at libstd/rt.rs:58\n  13:     0x55fa0ebaae71 - std::rt::lang_start::h1b1de624209f414a\n                        at /checkout/src/libstd/rt.rs:74\n  14:     0x55fa0ebaacbd - main\n  15:     0x7f9946132f29 - __libc_start_main\n  16:     0x55fa0eba9b79 - _start\n  17:                0x0 - \u003cunknown\u003e'''\n```\n\n## Usage\n\n```rust no_run\nuse human_panic::setup_panic;\n\nfn main() {\n   setup_panic!();\n\n   println!(\"A normal log message\");\n   panic!(\"OMG EVERYTHING IS ON FIRE!!!\")\n}\n```\n\nIt only displays a human-friendly panic message in release mode:\n\n```sh\n$ cargo run --release\n```\n\n## Installation\n\n```sh\n$ cargo add human-panic\n```\n\n## License\n\nLicensed under either of\n\n* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or \u003chttp://www.apache.org/licenses/LICENSE-2.0\u003e)\n* MIT license ([LICENSE-MIT](LICENSE-MIT) or \u003chttp://opensource.org/licenses/MIT\u003e)\n\nat your option.\n\n### Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally\nsubmitted for inclusion in the work by you, as defined in the Apache-2.0\nlicense, shall be dual-licensed as above, without any additional terms or\nconditions.\n\n[1]: https://img.shields.io/crates/v/human-panic.svg?style=flat-square\n[2]: https://crates.io/crates/human-panic\n[3]: https://img.shields.io/travis/rust-cli/human-panic.svg?style=flat-square\n[4]: https://travis-ci.org/rust-cli/human-panic\n[5]: https://img.shields.io/crates/d/human-panic.svg?style=flat-square\n[6]: https://crates.io/crates/human-panic\n[7]: https://docs.rs/human-panic/badge.svg\n[8]: https://docs.rs/human-panic\n","funding_links":[],"categories":["Libraries","Rust","库 Libraries","库"],"sub_categories":["Command-line","命令行 Command-line","命令行"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frust-cli%2Fhuman-panic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frust-cli%2Fhuman-panic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frust-cli%2Fhuman-panic/lists"}