mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-07-15 20:40:35 -07:00
fix(cli): suppress unhandled AbortError logs during request cancellation (#22621)
This commit is contained in:
@@ -164,6 +164,14 @@ export function getNodeMemoryArgs(isDebugMode: boolean): string[] {
|
||||
export function setupUnhandledRejectionHandler() {
|
||||
let unhandledRejectionOccurred = false;
|
||||
process.on('unhandledRejection', (reason, _promise) => {
|
||||
// AbortError is expected when the user cancels a request (e.g. pressing ESC).
|
||||
// It may surface as an unhandled rejection due to async timing in the
|
||||
// streaming pipeline, but it is not a bug.
|
||||
if (reason instanceof Error && reason.name === 'AbortError') {
|
||||
debugLogger.log(`Suppressed unhandled AbortError: ${reason.message}`);
|
||||
return;
|
||||
}
|
||||
|
||||
const errorMessage = `=========================================
|
||||
This is an unexpected error. Please file a bug report using the /bug tool.
|
||||
CRITICAL: Unhandled Promise Rejection!
|
||||
|
||||
Reference in New Issue
Block a user