honeybadger

Crates.iohoneybadger
lib.rshoneybadger
version0.2.1
sourcesrc
created_at2018-07-12 22:32:04.696814
updated_at2019-05-13 14:03:30.117186
descriptionA Honeybadger client for rust
homepage
repository
max_upload_size
id73966
size37,889
Niel Drummond (fussybeaver)

documentation

README

Build Status

honeybadger

An unofficial Honeybadger Rust client

Description

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.

Example

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.

use tokio::prelude::*;
use tokio::prelude::future::result;
use tokio::runtime::run;

fn do_work() -> Result<()> {

  // write code ...

  Ok(())
}

// let api_token = "...";
let config = ConfigBuilder::new(api_token).build();
let mut hb = Honeybadger::new(config).unwrap();

let work = result(do_work())
  .or_else(move |e| result(hb.create_payload(&e, None))
                      .and_then(move |payload| hb.notify(payload)))
  .map_err(|e| println!("error = {:?}", e));

run(work);

License: MIT

Commit count: 0

cargo fmt