error/error.rs
1#[macro_use]
2extern crate rollbar;
3extern crate backtrace;
4
5fn main() {
6 let client = rollbar::Client::new("ACCESS_TOKEN", "ENVIRONMENT");
7
8 match "笑".parse::<i32>() {
9 Ok(_) => { println!("lolnope"); },
10 Err(e) => { let _ = report_error!(client, e).join(); }
11 }
12
13 /* // `report_error!` expands to the following code:
14 * let backtrace = backtrace::Backtrace::new();
15 * let line = line!() - 2;
16 *
17 * client.build_report()
18 * .from_error(&e)
19 * .with_frame(rollbar::FrameBuilder::new()
20 * .with_line_number(line)
21 * .with_file_name(file!())
22 * .build())
23 * .with_backtrace(&backtrace)
24 * .send();
25 * // If you want to customize the report, you might not want to use the macro.
26 * // Join the thread only for testing purposes.
27 */
28}