mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-22 23:15:56 +08:00
fix(@angular/cli): do not show stack on argument parse error
This commit is contained in:
parent
f7f5b28dae
commit
97576ecd13
@ -182,9 +182,20 @@ export async function runCommand(
|
||||
return 1;
|
||||
}
|
||||
|
||||
try {
|
||||
const parsedOptions = parser.parseArguments(args, description.options);
|
||||
Command.setCommandMap(commandMap);
|
||||
const command = new description.impl({ workspace }, description, logger);
|
||||
|
||||
return await command.validateAndRun(parsedOptions);
|
||||
} catch (e) {
|
||||
if (e instanceof parser.ParseArgumentException) {
|
||||
logger.fatal('Cannot parse arguments. See below for the reasons.');
|
||||
logger.fatal(' ' + e.comments.join('\n '));
|
||||
|
||||
return 1;
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ import { Arguments, Option, OptionType, Value } from './interface';
|
||||
|
||||
export class ParseArgumentException extends BaseException {
|
||||
constructor(
|
||||
comments: string[],
|
||||
public readonly comments: string[],
|
||||
public readonly parsed: Arguments,
|
||||
public readonly ignored: string[],
|
||||
) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user