mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-13 05:12:55 -07: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) {
|
} else if (toolResult.error === undefined) {
|
||||||
return await this.createSuccessResult(call, toolResult);
|
return await this.createSuccessResult(call, toolResult);
|
||||||
} else {
|
} else {
|
||||||
|
const displayText =
|
||||||
|
typeof toolResult.returnDisplay === 'string'
|
||||||
|
? toolResult.returnDisplay
|
||||||
|
: undefined;
|
||||||
return this.createErrorResult(
|
return this.createErrorResult(
|
||||||
call,
|
call,
|
||||||
new Error(toolResult.error.message),
|
new Error(toolResult.error.message),
|
||||||
toolResult.error.type,
|
toolResult.error.type,
|
||||||
|
displayText,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} catch (executionError: unknown) {
|
} catch (executionError: unknown) {
|
||||||
@@ -271,8 +276,14 @@ export class ToolExecutor {
|
|||||||
call: ToolCall,
|
call: ToolCall,
|
||||||
error: Error,
|
error: Error,
|
||||||
errorType?: ToolErrorType,
|
errorType?: ToolErrorType,
|
||||||
|
returnDisplay?: string,
|
||||||
): ErroredToolCall {
|
): 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;
|
const startTime = 'startTime' in call ? call.startTime : undefined;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -289,7 +300,9 @@ export class ToolExecutor {
|
|||||||
request: ToolCallRequestInfo,
|
request: ToolCallRequestInfo,
|
||||||
error: Error,
|
error: Error,
|
||||||
errorType: ToolErrorType | undefined,
|
errorType: ToolErrorType | undefined,
|
||||||
|
returnDisplay?: string,
|
||||||
): ToolCallResponseInfo {
|
): ToolCallResponseInfo {
|
||||||
|
const displayText = returnDisplay ?? error.message;
|
||||||
return {
|
return {
|
||||||
callId: request.callId,
|
callId: request.callId,
|
||||||
error,
|
error,
|
||||||
@@ -302,9 +315,9 @@ export class ToolExecutor {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
resultDisplay: error.message,
|
resultDisplay: displayText,
|
||||||
errorType,
|
errorType,
|
||||||
contentLength: error.message.length,
|
contentLength: displayText.length,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user