aboutsummaryrefslogtreecommitdiffstats
path: root/src/error.rs
diff options
context:
space:
mode:
authorTeddy Wing2020-08-02 00:47:53 +0200
committerTeddy Wing2020-08-02 00:47:53 +0200
commit13710b49cc40c0e78eec9a94ce9b0ea8a09c3860 (patch)
tree0ded95e864a307ba733a9134f28df40273665873 /src/error.rs
parentdff81f7b84c279d7e00fe7a885743605a2ac5b7e (diff)
downloadgit-suggestion-13710b49cc40c0e78eec9a94ce9b0ea8a09c3860.tar.bz2
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: ".
Diffstat (limited to 'src/error.rs')
-rw-r--r--src/error.rs8
1 files changed, 8 insertions, 0 deletions
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);
+ })
+}