napi-rs/examples/napi/src/error.rs

12 lines
210 B
Rust
Raw Normal View History

2021-09-24 10:46:27 +09:00
use napi::bindgen_prelude::*;
#[napi]
pub fn throw_error() -> Result<()> {
2021-09-24 10:46:27 +09:00
Err(Error::new(Status::InvalidArg, "Manual Error".to_owned()))
}
#[napi(catch_unwind)]
pub fn panic() {
panic!("Don't panic");
}