From ad00cfec5720a8c94339e9706467e4cfb2feb789 Mon Sep 17 00:00:00 2001 From: davelopez <46503462+davelopez@users.noreply.github.com> Date: Thu, 30 Apr 2026 16:52:58 +0200 Subject: [PATCH 1/3] Fix error handling for Help Forum integration --- client/src/components/Tool/ToolHelpForum.vue | 9 +++-- lib/galaxy/webapps/galaxy/services/help.py | 38 +++++++++++++++----- 2 files changed, 37 insertions(+), 10 deletions(-) diff --git a/client/src/components/Tool/ToolHelpForum.vue b/client/src/components/Tool/ToolHelpForum.vue index 912b417a425..49589dec860 100644 --- a/client/src/components/Tool/ToolHelpForum.vue +++ b/client/src/components/Tool/ToolHelpForum.vue @@ -6,10 +6,12 @@ import { computed, onMounted, ref } from "vue"; import { GalaxyApi } from "@/api"; import { galaxyLogo } from "@/components/icons/galaxyIcons"; import { useConfigStore } from "@/stores/configurationStore"; +import { errorMessageAsString } from "@/utils/simple-error"; import { getShortToolId } from "@/utils/tool"; import { createTopicUrl, type HelpForumPost, type HelpForumTopic, useHelpURLs } from "./helpForumUrls"; +import Alert from "@/components/Alert.vue"; import Heading from "@/components/Common/Heading.vue"; import ExternalLink from "@/components/ExternalLink.vue"; @@ -22,6 +24,7 @@ const toolHelpTag = "tool-help"; const topics = ref([]); const posts = ref([]); +const errorMessage = ref(""); const helpAvailable = computed(() => topics.value.length > 0); const root = ref(null); @@ -36,7 +39,7 @@ onMounted(async () => { }, }); if (error) { - console.error("Error fetching help forum data", error); + errorMessage.value = errorMessageAsString(error, "Failed to search the Help Forum."); } topics.value = data?.topics ?? []; @@ -66,12 +69,14 @@ const configStore = useConfigStore();
Help Forum + +

Following questions on the Help Forum may be related to this tool:

-

+

There are no questions on the Help Forum about this tool. diff --git a/lib/galaxy/webapps/galaxy/services/help.py b/lib/galaxy/webapps/galaxy/services/help.py index e75bf087e68..476dda38d4c 100644 --- a/lib/galaxy/webapps/galaxy/services/help.py +++ b/lib/galaxy/webapps/galaxy/services/help.py @@ -1,7 +1,11 @@ import logging from galaxy.config import GalaxyAppConfiguration -from galaxy.exceptions import ServerNotConfiguredForRequest +from galaxy.exceptions import ( + InternalServerError, + MessageException, + ServerNotConfiguredForRequest, +) from galaxy.schema.help import HelpForumSearchResponse from galaxy.security.idencoding import IdEncodingHelper from galaxy.util import requests @@ -34,10 +38,28 @@ class HelpService(ServiceBase): if not self.config.help_forum_api_url: raise ServerNotConfiguredForRequest("Help forum API URL is not configured.") forum_search_url = f"{self.config.help_forum_api_url}/search.json" - response = requests.get( - url=forum_search_url, - params={ - "q": query, - }, - ) - return HelpForumSearchResponse(**response.json()) + try: + response = requests.get( + url=forum_search_url, + params={ + "q": query, + }, + ) + except requests.exceptions.ConnectionError: + raise MessageException( + "Could not connect to the Galaxy Help Forum. The service may be temporarily unavailable." + ) + except requests.exceptions.Timeout: + raise MessageException("The request to the Galaxy Help Forum timed out. Please try again later.") + except requests.exceptions.RequestException as e: + raise InternalServerError(f"An error occurred while requesting the Galaxy Help Forum: {e}") + + if not response.ok: + raise MessageException( + f"The Galaxy Help Forum returned an error (HTTP {response.status_code}). Please try again later." + ) + + try: + return HelpForumSearchResponse(**response.json()) + except ValueError as e: + raise InternalServerError(f"Received an unexpected response format from the Galaxy Help Forum: {e}") From c66919c0a8b95447e634aeeb0feb00c4f2284854 Mon Sep 17 00:00:00 2001 From: davelopez <46503462+davelopez@users.noreply.github.com> Date: Mon, 4 May 2026 14:52:12 +0200 Subject: [PATCH 2/3] Improves error handling for Help Forum requests Enhances error reporting and logging for Help Forum API failures, distinguishing between connection errors, timeouts, client errors, and server errors. Provides more actionable error messages for misconfiguration cases and improves diagnostics for administrators. --- lib/galaxy/webapps/galaxy/services/help.py | 38 +++++++++++++++++----- 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/lib/galaxy/webapps/galaxy/services/help.py b/lib/galaxy/webapps/galaxy/services/help.py index 476dda38d4c..279fcd3c743 100644 --- a/lib/galaxy/webapps/galaxy/services/help.py +++ b/lib/galaxy/webapps/galaxy/services/help.py @@ -2,9 +2,10 @@ import logging from galaxy.config import GalaxyAppConfiguration from galaxy.exceptions import ( + GatewayTimeoutException, InternalServerError, - MessageException, ServerNotConfiguredForRequest, + UpstreamProxyError, ) from galaxy.schema.help import HelpForumSearchResponse from galaxy.security.idencoding import IdEncodingHelper @@ -45,19 +46,40 @@ class HelpService(ServiceBase): "q": query, }, ) - except requests.exceptions.ConnectionError: - raise MessageException( + except requests.exceptions.ConnectionError as e: + log.error("Could not connect to the Galaxy Help Forum at %s: %s", forum_search_url, e) + raise UpstreamProxyError( "Could not connect to the Galaxy Help Forum. The service may be temporarily unavailable." ) - except requests.exceptions.Timeout: - raise MessageException("The request to the Galaxy Help Forum timed out. Please try again later.") + except requests.exceptions.Timeout as e: + log.error("Request to the Galaxy Help Forum at %s timed out: %s", forum_search_url, e) + raise GatewayTimeoutException("The request to the Galaxy Help Forum timed out. Please try again later.") except requests.exceptions.RequestException as e: + log.error("Unexpected error requesting the Galaxy Help Forum at %s: %s", forum_search_url, e) raise InternalServerError(f"An error occurred while requesting the Galaxy Help Forum: {e}") if not response.ok: - raise MessageException( - f"The Galaxy Help Forum returned an error (HTTP {response.status_code}). Please try again later." - ) + if 400 <= response.status_code < 500: + log.error( + "The Galaxy Help Forum returned a client error (HTTP %d) from %s. " + "This likely indicates a misconfigured URL or API key.", + response.status_code, + forum_search_url, + ) + raise InternalServerError( + f"The Galaxy Help Forum returned an error (HTTP {response.status_code}). " + "This may indicate a misconfigured URL or API key that requires admin intervention." + ) + else: + log.error( + "The Galaxy Help Forum returned a server error (HTTP %d) from %s", + response.status_code, + forum_search_url, + ) + raise UpstreamProxyError( + f"The Galaxy Help Forum returned an error (HTTP {response.status_code}). " + "The service may be temporarily unavailable. Please try again later." + ) try: return HelpForumSearchResponse(**response.json()) From 68a5318853998117a2ccb8029bab0166cb259a80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20L=C3=B3pez?= <46503462+davelopez@users.noreply.github.com> Date: Wed, 20 May 2026 09:50:25 +0200 Subject: [PATCH 3/3] Remove redundant exception logs Co-authored-by: Marius van den Beek --- lib/galaxy/webapps/galaxy/services/help.py | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/lib/galaxy/webapps/galaxy/services/help.py b/lib/galaxy/webapps/galaxy/services/help.py index 279fcd3c743..ffc317a5afa 100644 --- a/lib/galaxy/webapps/galaxy/services/help.py +++ b/lib/galaxy/webapps/galaxy/services/help.py @@ -46,36 +46,22 @@ class HelpService(ServiceBase): "q": query, }, ) - except requests.exceptions.ConnectionError as e: - log.error("Could not connect to the Galaxy Help Forum at %s: %s", forum_search_url, e) + except requests.exceptions.ConnectionError: raise UpstreamProxyError( "Could not connect to the Galaxy Help Forum. The service may be temporarily unavailable." ) - except requests.exceptions.Timeout as e: - log.error("Request to the Galaxy Help Forum at %s timed out: %s", forum_search_url, e) + except requests.exceptions.Timeout: raise GatewayTimeoutException("The request to the Galaxy Help Forum timed out. Please try again later.") except requests.exceptions.RequestException as e: - log.error("Unexpected error requesting the Galaxy Help Forum at %s: %s", forum_search_url, e) raise InternalServerError(f"An error occurred while requesting the Galaxy Help Forum: {e}") if not response.ok: if 400 <= response.status_code < 500: - log.error( - "The Galaxy Help Forum returned a client error (HTTP %d) from %s. " - "This likely indicates a misconfigured URL or API key.", - response.status_code, - forum_search_url, - ) raise InternalServerError( f"The Galaxy Help Forum returned an error (HTTP {response.status_code}). " "This may indicate a misconfigured URL or API key that requires admin intervention." ) else: - log.error( - "The Galaxy Help Forum returned a server error (HTTP %d) from %s", - response.status_code, - forum_search_url, - ) raise UpstreamProxyError( f"The Galaxy Help Forum returned an error (HTTP {response.status_code}). " "The service may be temporarily unavailable. Please try again later."