Skip to content

Commit 8c03c7c

Browse files
author
linyuan.yang
committed
精简 createErrorResult
1 parent d1d1df7 commit 8c03c7c

6 files changed

Lines changed: 6 additions & 6 deletions

File tree

‎packages/sbot/src/Tools/Channel/list.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export function createChannelListTool(currentChannelId?: string): StructuredTool
7474
));
7575
} catch (e: any) {
7676
logger.error(`${CHANNEL_LIST_TOOL_NAME} failed: ${formatError(e, true)}`);
77-
return createErrorResult(`Failed to list: ${formatError(e)}`);
77+
return createErrorResult(formatError(e));
7878
}
7979
},
8080
});

‎packages/sbot/src/Tools/Channel/send.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export function createChannelSendTool(): StructuredToolInterface {
5151
return createSuccessResult(createTextContent('ok'));
5252
} catch (e: any) {
5353
logger.error(`${CHANNEL_SEND_TOOL_NAME} failed: ${formatError(e, true)}`);
54-
return createErrorResult(`Send failed: ${formatError(e)}`);
54+
return createErrorResult(formatError(e));
5555
}
5656
},
5757
});

‎packages/sbot/src/Tools/SessionSearch/index.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export function createSessionSearchTool(saver: SearchableSaver | null): Structur
6767
}).join('\n\n---\n\n');
6868
return createSuccessResult(createTextContent(`Found ${results.length} results:\n\n${formatted}`));
6969
} catch (e: any) {
70-
return createErrorResult(`Search failed for query=${JSON.stringify(query)}: ${formatError(e)}`);
70+
return createErrorResult(formatError(e));
7171
}
7272
},
7373
});

‎packages/sbot/src/Tools/Web/download.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ export function createWebDownloadTool(): StructuredToolInterface {
109109
}
110110

111111
return createErrorResult(
112-
`Download failed after ${maxRetries} attempt(s). Last error: ${formatError(lastError)}\nURL: ${url}`,
112+
`Download failed after ${maxRetries} attempt(s). Last error: ${formatError(lastError)}`,
113113
)
114114
},
115115
})

‎packages/sbot/src/Tools/Web/fetch.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ export function createWebFetchTool(): StructuredToolInterface {
160160
return createErrorResult(`Request timed out after ${timeoutMs / 1000} seconds: ${url}`)
161161
}
162162
logger.error(`WebFetch error for ${url}: ${formatError(err, true)}`)
163-
return createErrorResult(`Failed to fetch ${url}: ${formatError(err)}`)
163+
return createErrorResult(formatError(err))
164164
} finally {
165165
clearTimeout(timeoutId)
166166
}

‎packages/scorpio.ai/src/Skills/SkillService.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ export class SkillService implements ISkillService {
173173
return await runShellCommand(command, cwd, timeout, label, stdin);
174174
} catch (error: any) {
175175
this.logger?.error(`Error executing skill ${skillName}: ${formatError(error, true)}`);
176-
return createErrorResult(`Error: ${formatError(error)}`);
176+
return createErrorResult(formatError(error));
177177
}
178178
}
179179
});

0 commit comments

Comments
 (0)