diff --git a/src/debug.rs b/src/debug.rs index dc974be5..d9908c38 100644 --- a/src/debug.rs +++ b/src/debug.rs @@ -21,6 +21,15 @@ macro_rules! nih_log { } pub use nih_log; +/// Similar to `nih_log!()`, more scream-y. Used for printing fatal errors. +#[macro_export] +macro_rules! nih_error { + ($($args:tt)*) => ( + $crate::log::error!($($args)*) + ); +} +pub use nih_error; + /// The same as `nih_log!()`, but with source and thread information. Like the /// `nih_debug_assert*!()` macros, this is only shown when compiling in debug mode. #[macro_export] diff --git a/src/wrapper/standalone.rs b/src/wrapper/standalone.rs index d3381de6..a888418f 100644 --- a/src/wrapper/standalone.rs +++ b/src/wrapper/standalone.rs @@ -80,7 +80,7 @@ pub fn nih_export_standalone_with_args match backend::Jack::new(config.clone()) { Ok(backend) => run_wrapper::(backend, config), Err(err) => { - nih_log!("{:#}", err); + nih_error!("Could not initialize the JACK backend: {:#}", err); false } }, @@ -112,10 +112,10 @@ fn run_wrapper(backend: B, config: WrapperConfig) -> bool fn print_error(error: WrapperError, config: &WrapperConfig) { match error { WrapperError::IncompatibleConfig => { - eprintln!("The plugin does not support the {} channel input and {} channel output configuration", config.input_channels, config.output_channels); + nih_error!("The plugin does not support the {} channel input and {} channel output configuration", config.input_channels, config.output_channels); } WrapperError::InitializationFailed => { - eprintln!("The plugin failed to initialize"); + nih_error!("The plugin failed to initialize"); } } } diff --git a/src/wrapper/standalone/backend.rs b/src/wrapper/standalone/backend.rs index a51a9726..8b790457 100644 --- a/src/wrapper/standalone/backend.rs +++ b/src/wrapper/standalone/backend.rs @@ -77,7 +77,7 @@ impl Jack { /// Initialize the JACK backend. Returns an error if this failed for whatever reason. pub fn new(config: WrapperConfig) -> Result { // TODO: Actually implement the JACK backend - anyhow::bail!("Could not initialize JACK backend") + anyhow::bail!("Not yet implemented") // Ok(Self { config }) } } diff --git a/src/wrapper/standalone/wrapper.rs b/src/wrapper/standalone/wrapper.rs index 90730ad8..63ec5246 100644 --- a/src/wrapper/standalone/wrapper.rs +++ b/src/wrapper/standalone/wrapper.rs @@ -388,8 +388,8 @@ impl Wrapper { }, &mut self.make_process_context(transport), ) { - eprintln!("The plugin returned an error while processing:"); - eprintln!("{}", err); + nih_error!("The plugin returned an error while processing:"); + nih_error!("{}", err); let push_successful = gui_task_sender.send(GuiTask::Close).is_ok(); nih_debug_assert!(