From 13710b49cc40c0e78eec9a94ce9b0ea8a09c3860 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sun, 2 Aug 2020 00:47:53 +0200 Subject: git-sugpatch: Print error and exit on `Config::get` error Add `exitcode` to exit with an appropriate code. Add the `gseprintln` macro to wrap `eprintln!()`, prefixing the output with "error: ". --- src/error.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/error.rs') diff --git a/src/error.rs b/src/error.rs index c857bd2..bcca3e1 100644 --- a/src/error.rs +++ b/src/error.rs @@ -7,3 +7,11 @@ pub enum Error { #[error("Unable to parse regex")] Regex(#[from] regex::Error), } + + +#[macro_export] +macro_rules! gseprintln { + ($arg:expr) => ({ + eprintln!("error: {}", $arg); + }) +} -- cgit v1.2.3