aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2023-02-21 16:47:50 +0400
committerMarc-André Lureau <marcandre.lureau@redhat.com>2023-03-13 15:23:37 +0400
commit3ffef1a55ca3b55fa64d43cd35af5adb2c260463 (patch)
tree7bb3c98f6ba70acdeaf0b538aaa5cd04517c9a8c /util
parent6bbee5dbaae1bebf5e37d3d2083584673d439631 (diff)
error: add global &error_warn destination
This can help debugging issues or develop, when error handling is introduced. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Stefan Berger <stefanb@linux.ibm.com> Message-Id: <20230221124802.4103554-6-marcandre.lureau@redhat.com>
Diffstat (limited to 'util')
-rw-r--r--util/error.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/util/error.c b/util/error.c
index 1e7af665b8..5537245da6 100644
--- a/util/error.c
+++ b/util/error.c
@@ -27,8 +27,9 @@ struct Error
Error *error_abort;
Error *error_fatal;
+Error *error_warn;
-static void error_handle_fatal(Error **errp, Error *err)
+static void error_handle(Error **errp, Error *err)
{
if (errp == &error_abort) {
fprintf(stderr, "Unexpected error in %s() at %s:%d:\n",
@@ -43,6 +44,9 @@ static void error_handle_fatal(Error **errp, Error *err)
error_report_err(err);
exit(1);
}
+ if (errp == &error_warn) {
+ warn_report_err(err);
+ }
}
G_GNUC_PRINTF(6, 0)
@@ -71,7 +75,7 @@ static void error_setv(Error **errp,
err->line = line;
err->func = func;
- error_handle_fatal(errp, err);
+ error_handle(errp, err);
*errp = err;
errno = saved_errno;
@@ -284,7 +288,7 @@ void error_propagate(Error **dst_errp, Error *local_err)
if (!local_err) {
return;
}
- error_handle_fatal(dst_errp, local_err);
+ error_handle(dst_errp, local_err);
if (dst_errp && !*dst_errp) {
*dst_errp = local_err;
} else {