An unofficial Honeybadger Rust client
Honeybadger is a service that receives, stores and alerts on application errors and outages. This library is a community-provided client for the Honeybadger Exceptions API.
Underneath, the client uses a Tokio-based version of
Hyper, and leverages
ErrorChain to support backtraces. Basic
support for the Failure Error struct exists
through a From
trait, and hence the possibility for further compatibility with other custom
Error implementations.
Assuming the project is setup to use
ErrorChain, the following
example will execute code in do_work
, send a honeybadger exception if it fails, and
subsequently end the program.
```rust use tokio::prelude::*; use tokio::prelude::future::result; use tokio::runtime::run;
fn do_work() -> Result<()> {
// write code ...
Ok(()) }
// let apitoken = "..."; let config = ConfigBuilder::new(apitoken).build(); let mut hb = Honeybadger::new(config).unwrap();
let work = result(dowork()) .orelse(move |e| result(hb.createpayload(&e, None)) .andthen(move |payload| hb.notify(payload))) .map_err(|e| println!("error = {:?}", e));
run(work); ``` License: MIT