mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-21 01:07:46 +00:00
Standardize exit codes (#7055)
This commit is contained in:
committed by
GitHub
parent
415a36a195
commit
7e31577813
@@ -18,7 +18,7 @@ import open from 'open';
|
||||
import path from 'node:path';
|
||||
import { promises as fs } from 'node:fs';
|
||||
import type { Config } from '../config/config.js';
|
||||
import { getErrorMessage } from '../utils/errors.js';
|
||||
import { getErrorMessage, FatalAuthenticationError } from '../utils/errors.js';
|
||||
import { UserAccountManager } from '../utils/userAccountManager.js';
|
||||
import { AuthType } from '../core/contentGenerator.js';
|
||||
import readline from 'node:readline';
|
||||
@@ -142,7 +142,9 @@ async function initOauthClient(
|
||||
}
|
||||
}
|
||||
if (!success) {
|
||||
process.exit(1);
|
||||
throw new FatalAuthenticationError(
|
||||
'Failed to authenticate with user code.',
|
||||
);
|
||||
}
|
||||
} else {
|
||||
const webLogin = await authWithWeb(client);
|
||||
@@ -166,7 +168,7 @@ async function initOauthClient(
|
||||
console.error(
|
||||
'Failed to open browser automatically. Please try running again with NO_BROWSER=true set.',
|
||||
);
|
||||
process.exit(1);
|
||||
throw new FatalAuthenticationError('Failed to open browser.');
|
||||
});
|
||||
} catch (err) {
|
||||
console.error(
|
||||
@@ -174,7 +176,7 @@ async function initOauthClient(
|
||||
err,
|
||||
'\nPlease try running again with NO_BROWSER=true set.',
|
||||
);
|
||||
process.exit(1);
|
||||
throw new FatalAuthenticationError('Failed to open browser.');
|
||||
}
|
||||
console.log('Waiting for authentication...');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user