mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-22 09:47:47 +00:00
wip(vscode-ide-companion): OnboardingPage
This commit is contained in:
26
packages/vscode-ide-companion/src/utils/authErrors.ts
Normal file
26
packages/vscode-ide-companion/src/utils/authErrors.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2025 Qwen Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
const AUTH_ERROR_PATTERNS = [
|
||||
'Authentication required',
|
||||
'(code: -32000)',
|
||||
'Unauthorized',
|
||||
'Invalid token',
|
||||
'Session expired',
|
||||
];
|
||||
|
||||
export const isAuthenticationRequiredError = (error: unknown): boolean => {
|
||||
if (!error) {
|
||||
return false;
|
||||
}
|
||||
const message =
|
||||
error instanceof Error
|
||||
? error.message
|
||||
: typeof error === 'string'
|
||||
? error
|
||||
: String(error);
|
||||
return AUTH_ERROR_PATTERNS.some((pattern) => message.includes(pattern));
|
||||
};
|
||||
Reference in New Issue
Block a user