explicit error typing

This commit is contained in:
Reece Browne 2025-08-15 13:07:47 +01:00
parent af6ef53aed
commit 463daf2ed0

View File

@ -36,7 +36,13 @@ const extractFromJsonData = (data: unknown): string | null => {
/** /**
* Default error extractor that follows the standard pattern * 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 // Try response.data first
if (typedError.response?.data) { if (typedError.response?.data) {