Unify unknown command and subcommand exit code classification

This commit is contained in:
gitea committed 2026-09-11 10:02:50 +08:00
1 parent bda8b82157
commit 225321f34a
5 files changed
+80 -61

No files matched your search

+3 -3
View File
@@ -22,7 +22,7 @@ import {
import { outputOptions } from "../printer.js";
import type { ParsedArgs } from "../types.js";
import type { MaterialPackFilePolicyPatch } from "../../domains/seal/material-pack/policy.js";
import { CliError, confirmationRequired } from "../errors.js";
import { CliError, confirmationRequired, usageError } from "../errors.js";
export async function handleWebhookMaterialPackPreview(
filePath: string,
@@ -182,7 +182,7 @@ export async function handleWebhookCommand(
const secret = stringOption(args.options.secret);
const rotateSecret = booleanOption(args.options.rotateSecret) ?? booleanOption(args.options["rotate-secret"]);
if (secret !== undefined && rotateSecret) {
throw new Error("Use either --secret or --rotate-secret, not both");
throw usageError("Use either --secret or --rotate-secret, not both");
}
const name = stringOption(args.options.name);
const mode = parseWebhookMode(stringOption(args.options.mode));
@@ -204,7 +204,7 @@ export async function handleWebhookCommand(
materialPackFilePolicy === undefined &&
!dryRun
) {
throw new Error("Webhook update requires at least one field option");
throw usageError("Webhook update requires at least one field option");
}
await runTool(
"seal_webhook_update",