summaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2016-08-27 03:40:19 (GMT)
committerWerner Almesberger <werner@almesberger.net>2016-08-27 03:40:19 (GMT)
commit19b6ddff92b79530add41b2b6205035bea362cb2 (patch)
treedebf5ccc7926b06b8648a3c931e2551b9ea83424 /misc
parentc295e78036c8102e088392a29037b3378da205f5 (diff)
downloadeeshow-19b6ddff92b79530add41b2b6205035bea362cb2.zip
eeshow-19b6ddff92b79530add41b2b6205035bea362cb2.tar.gz
eeshow-19b6ddff92b79530add41b2b6205035bea362cb2.tar.bz2
misc/diag.c (pfatal_git, perror_git): convenience functions for error reporting
Diffstat (limited to 'misc')
-rw-r--r--misc/diag.c18
-rw-r--r--misc/diag.h2
2 files changed, 20 insertions, 0 deletions
diff --git a/misc/diag.c b/misc/diag.c
index 5294129..7ab7908 100644
--- a/misc/diag.c
+++ b/misc/diag.c
@@ -17,6 +17,7 @@
#include <string.h>
#include <errno.h>
+#include <git2.h>
#include "misc/diag.h"
@@ -39,8 +40,25 @@ void diag_perror(const char *s)
}
+void pfatal_git(const char *s)
+{
+ const git_error *e = giterr_last();
+
+ fatal("%s: %s", s, e->message);
+}
+
+
+void perror_git(const char *s)
+{
+ const git_error *e = giterr_last();
+
+ error("%s: %s", s, e->message);
+}
+
+
/* ----- General diagnostic functions -------------------------------------- */
+
void fatal(const char *fmt, ...)
{
va_list ap;
diff --git a/misc/diag.h b/misc/diag.h
index 5e2df87..8adddbb 100644
--- a/misc/diag.h
+++ b/misc/diag.h
@@ -41,6 +41,8 @@ extern unsigned verbose;
void __attribute__((noreturn)) diag_pfatal(const char *s);
void diag_perror(const char *s);
+void __attribute__((noreturn)) pfatal_git(const char *s);
+void perror_git(const char *s);
/* ----- General diagnostic functions -------------------------------------- */