From 94aa0bdda34cd382c342458809ee16dd9bd0441b Mon Sep 17 00:00:00 2001 From: icex2 Date: Sun, 25 Feb 2024 09:34:37 +0100 Subject: [PATCH] feat(avs-util): Add helper to translate property errors --- src/main/avs-util/error.c | 10 ++++++++++ src/main/avs-util/error.h | 4 +++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/main/avs-util/error.c b/src/main/avs-util/error.c index ab09c01..d31b2e1 100644 --- a/src/main/avs-util/error.c +++ b/src/main/avs-util/error.c @@ -96,4 +96,14 @@ const char *avs_util_error_str(avs_error error) } return avs_util_error_unknown; +} + +const char *avs_util_property_error_get_and_clear(struct property *prop) +{ + avs_error error; + + error = property_get_error(prop); + property_clear_error(prop); + + return avs_util_error_str(error); } \ No newline at end of file diff --git a/src/main/avs-util/error.h b/src/main/avs-util/error.h index 3598851..88d68c5 100644 --- a/src/main/avs-util/error.h +++ b/src/main/avs-util/error.h @@ -5,4 +5,6 @@ const char *avs_util_error_str(avs_error error); -#endif \ No newline at end of file +const char *avs_util_property_error_get_and_clear(struct property *prop); + +#endif