From e8618ab2b3b4e572bf9e329af1be7753577ec375 Mon Sep 17 00:00:00 2001 From: Corey Farwell Date: Mon, 22 Apr 2019 23:17:47 -0400 Subject: [PATCH] Update return type of notify to return a Result --- examples/hello_world.rs | 6 ++++-- src/lib.rs | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/examples/hello_world.rs b/examples/hello_world.rs index 02b8c2d..760a1a5 100644 --- a/examples/hello_world.rs +++ b/examples/hello_world.rs @@ -1,3 +1,5 @@ -fn main() { - notifica::notify("Hello", "World! 🌍"); +use std::error::Error; + +fn main() -> Result<(), Box> { + notifica::notify("Hello", "World! 🌍") } diff --git a/src/lib.rs b/src/lib.rs index 421fd61..aa55b1c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -197,7 +197,8 @@ type CurrPlatform = MacOs; #[cfg(target_os = "linux")] type CurrPlatform = Linux; -pub fn notify(msg_title: &str, msg_body: &str) { +pub fn notify(msg_title: &str, msg_body: &str) -> Result<(), Box> { CurrPlatform::setup(); - CurrPlatform::notify(msg_title, msg_body); + CurrPlatform::notify(msg_title, msg_body)?; + Ok(()) } -- 2.51.2