From 4ac66baccc1d0e7c534f32f0f9cc58de559c26b8 Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Mon, 18 Apr 2022 21:59:12 +0300 Subject: [PATCH] mu-result: add assert_valid_result Useful for unit tests --- lib/utils/mu-result.hh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/utils/mu-result.hh b/lib/utils/mu-result.hh index ea568aad..0d93b172 100644 --- a/lib/utils/mu-result.hh +++ b/lib/utils/mu-result.hh @@ -115,6 +115,14 @@ Err(Error::Code errcode, GError **err, const char* frm, ...) return Err(errcode, std::move(str)); } +#define assert_valid_result(R) do { \ + if(!R) { \ + g_critical("error-result: %s", (R).error().what()); \ + } \ + } \ + while(0) + + }// namespace Mu