mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-02-01 22:48:03 +00:00
fix(core): use returnDisplay for error result display (#14994)
Co-authored-by: Sehoon Shon <sshon@google.com>
This commit is contained in:
@@ -123,10 +123,15 @@ export class ToolExecutor {
|
||||
} else if (toolResult.error === undefined) {
|
||||
return await this.createSuccessResult(call, toolResult);
|
||||
} else {
|
||||
const displayText =
|
||||
typeof toolResult.returnDisplay === 'string'
|
||||
? toolResult.returnDisplay
|
||||
: undefined;
|
||||
return this.createErrorResult(
|
||||
call,
|
||||
new Error(toolResult.error.message),
|
||||
toolResult.error.type,
|
||||
displayText,
|
||||
);
|
||||
}
|
||||
} catch (executionError: unknown) {
|
||||
@@ -271,8 +276,14 @@ export class ToolExecutor {
|
||||
call: ToolCall,
|
||||
error: Error,
|
||||
errorType?: ToolErrorType,
|
||||
returnDisplay?: string,
|
||||
): ErroredToolCall {
|
||||
const response = this.createErrorResponse(call.request, error, errorType);
|
||||
const response = this.createErrorResponse(
|
||||
call.request,
|
||||
error,
|
||||
errorType,
|
||||
returnDisplay,
|
||||
);
|
||||
const startTime = 'startTime' in call ? call.startTime : undefined;
|
||||
|
||||
return {
|
||||
@@ -289,7 +300,9 @@ export class ToolExecutor {
|
||||
request: ToolCallRequestInfo,
|
||||
error: Error,
|
||||
errorType: ToolErrorType | undefined,
|
||||
returnDisplay?: string,
|
||||
): ToolCallResponseInfo {
|
||||
const displayText = returnDisplay ?? error.message;
|
||||
return {
|
||||
callId: request.callId,
|
||||
error,
|
||||
@@ -302,9 +315,9 @@ export class ToolExecutor {
|
||||
},
|
||||
},
|
||||
],
|
||||
resultDisplay: error.message,
|
||||
resultDisplay: displayText,
|
||||
errorType,
|
||||
contentLength: error.message.length,
|
||||
contentLength: displayText.length,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user