mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-11 22:51:00 -07:00
* Starting to move a lot of code into packages/server * More of the massive refactor, builds and runs, some issues though. * Fixing outstanding issue with double messages. * Fixing a minor UI issue. * Fixing the build post-merge. * Running formatting. * Addressing comments.
25 lines
620 B
TypeScript
25 lines
620 B
TypeScript
/**
|
|
* @license
|
|
* Copyright 2025 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
export function isNodeError(error: unknown): error is NodeJS.ErrnoException {
|
|
return error instanceof Error && 'code' in error;
|
|
}
|
|
|
|
export function getErrorMessage(error: unknown): string {
|
|
if (error instanceof Error) {
|
|
return error.message;
|
|
} else {
|
|
// Attempt to convert the non-Error value to a string for logging
|
|
try {
|
|
const errorMessage = String(error);
|
|
return errorMessage;
|
|
} catch {
|
|
// If String() itself fails (highly unlikely)
|
|
return 'Failed to get error details';
|
|
}
|
|
}
|
|
}
|