Struct honeybadger::Honeybadger [−][src]
pub struct Honeybadger { /* fields omitted */ }
Instance containing the client connection and user configuration for this crate.
Methods
impl Honeybadger
[src]
impl Honeybadger
pub fn new(config: Config) -> Result<Self>
[src]
pub fn new(config: Config) -> Result<Self>
Constructs a Honeybadger instance, which may be used to send API notify requests.
Arguments
config
-Config
instance, which is built using theConfigBuilder
Example
let config = ConfigBuilder::new(api_token).build(); assert_eq!(true, Honeybadger::new(config).is_ok());
pub fn create_payload<'req, E>(
&mut self,
error: &E,
context: Option<HashMap<&'req str, &'req str>>
) -> Result<Request<Body>> where
E: ChainedError,
[src]
pub fn create_payload<'req, E>(
&mut self,
error: &E,
context: Option<HashMap<&'req str, &'req str>>
) -> Result<Request<Body>> where
E: ChainedError,
Prepare a payload for the notify request.
Requires the use of the error_chain crate.
Arguments
error
-ChainedError
compatible with an error_chain cratecontext
- OptionalHashMap
to pass to the Honeybadger context API
Example
error_chain! { errors { MyCustomError } } let error : Result<()> = Err(ErrorKind::MyCustomError.into()); honeybadger.create_payload(&error.unwrap_err(), None);
pub fn notify<'req>(
&mut self,
request: Request<Body>
) -> impl Future<Item = (), Error = Error>
[src]
pub fn notify<'req>(
&mut self,
request: Request<Body>
) -> impl Future<Item = (), Error = Error>
Trigger the notify request using an async HTTPS request.
Requires an initialized Tokio Runtime
, and returns a Future that must be
resolved using the Tokio framework orchestration methods.
Arguments
request
- Request instance constructed withcreate_payload
Example
let mut rt = current_thread::Runtime::new().unwrap(); let payload = honeybadger.create_payload(&error.unwrap_err(), None).unwrap(); let future = honeybadger.notify(payload); // note: blocks the current thread! rt.block_on(future);
Auto Trait Implementations
impl Send for Honeybadger
impl Send for Honeybadger
impl Sync for Honeybadger
impl Sync for Honeybadger