From 13a057f0b20c0e69c613e75b5750cb4a9aacf520 Mon Sep 17 00:00:00 2001 From: Trygve Aaberge Date: Fri, 13 Oct 2023 09:33:36 +0200 Subject: [PATCH] core: only print hook_url errors when debug is enabled Errors from hook_url should be handled by the caller, so don't print them to the core buffer by default. Only print them when weechat_debug_core is enabled. This was already the behavior for the timeout error. --- src/core/hook/wee-hook-url.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/core/hook/wee-hook-url.c b/src/core/hook/wee-hook-url.c index f34d767a2..07149461a 100644 --- a/src/core/hook/wee-hook-url.c +++ b/src/core/hook/wee-hook-url.c @@ -172,7 +172,7 @@ hook_url_timer_cb (const void *pointer, void *data, int remaining_calls) { hook_url_run_callback (hook); ptr_error = hashtable_get (HOOK_URL(hook, output), "error"); - if (ptr_error && ptr_error[0]) + if ((weechat_debug_core >= 1) && ptr_error && ptr_error[0]) { gui_chat_printf ( NULL, @@ -242,11 +242,14 @@ hook_url_transfer (struct t_hook *hook) str_error_code_pthread); hook_url_run_callback (hook); - gui_chat_printf (NULL, - _("%sError running thread in hook_url: %s (URL: \"%s\")"), - gui_chat_prefix[GUI_CHAT_PREFIX_ERROR], - strerror (rc), - HOOK_URL(hook, url)); + if (weechat_debug_core >= 1) + { + gui_chat_printf (NULL, + _("%sError running thread in hook_url: %s (URL: \"%s\")"), + gui_chat_prefix[GUI_CHAT_PREFIX_ERROR], + strerror (rc), + HOOK_URL(hook, url)); + } unhook (hook); return; }