mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-21 01:07:46 +00:00
Rename server->core (#638)
This commit is contained in:
committed by
GitHub
parent
c81148a0cc
commit
21fba832d1
22
packages/core/src/utils/errors.ts
Normal file
22
packages/core/src/utils/errors.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* @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 {
|
||||
try {
|
||||
const errorMessage = String(error);
|
||||
return errorMessage;
|
||||
} catch {
|
||||
return 'Failed to get error details';
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user