From: Christian Heller <c.heller@plomlompom.de>
Date: Mon, 26 Aug 2013 00:54:35 +0000 (+0200)
Subject: exit_err() now also prints the internal error code.
X-Git-Tag: tce~1049
X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/static/%7B%7Bprefix%7D%7D/%27%29;%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20chunks.push%28escapeHTML%28span%5B2%5D%29%29;%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20chunks.push%28%27?a=commitdiff_plain;h=7914b82edaf2df6c402ca3258314a2aabad58251;p=plomrogue

exit_err() now also prints the internal error code.
---

diff --git a/src/rexit.c b/src/rexit.c
index 31cf3ee..71ec130 100644
--- a/src/rexit.c
+++ b/src/rexit.c
@@ -72,7 +72,8 @@ extern void exit_err(uint8_t err, struct World * world, char * msg)
     {
         msg = "Details unknown.";
     }
-    printf("Aborted PlomRogue due to error. %s\n", msg);
+    printf("Aborted PlomRogue due to error. %s\nInternal error code: %d\n",
+           msg, err);
     if (0 != errno)
     {
         perror("errno states");
diff --git a/src/rexit.h b/src/rexit.h
index ac85577..d9d93b2 100644
--- a/src/rexit.h
+++ b/src/rexit.h
@@ -36,9 +36,8 @@ extern void exit_game(struct World * world);
 
 
 /* If "err" != 0, exit with an error message "msg" and clean up. If "msg" is a
- * NULL pointer, return generic error message. (For "err", pass the result of
- * functions that return non-zero as an error status and thereby avoid bloating
- * up the code with if-error-conditionals.)
+ * NULL pointer, return generic "Details unknown". In any case, also print "err"
+ * as the "internal error code". Also print errno if it is non-zero.
  */
 extern void exit_err(uint8_t err, struct World * world, char * msg);