From 463daf2ed03b871134469db15a212c1bd8920a6a Mon Sep 17 00:00:00 2001 From: Reece Browne Date: Fri, 15 Aug 2025 13:07:47 +0100 Subject: [PATCH] explicit error typing --- frontend/src/utils/toolErrorHandler.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/frontend/src/utils/toolErrorHandler.ts b/frontend/src/utils/toolErrorHandler.ts index 72a62e298..9d2ccca89 100644 --- a/frontend/src/utils/toolErrorHandler.ts +++ b/frontend/src/utils/toolErrorHandler.ts @@ -36,7 +36,13 @@ const extractFromJsonData = (data: unknown): string | null => { /** * Default error extractor that follows the standard pattern */ -export const extractErrorMessage = (error: ToolError): string => { +export const extractErrorMessage = (error: unknown): string => { + // Early return if error is null/undefined + if (!error || (typeof error !== 'object')) { + return 'Operation failed'; + } + + const typedError = error as ToolError; // Try response.data first if (typedError.response?.data) {