Module

x/wmill/deps.ts>Command#throwErrors

Open-source developer platform to turn scripts into workflows and UIs. Fastest workflow engine (5x vs Airflow). Open-source alternative to Airplane and Retool.
Go to Latest
method Command.prototype.throwErrors
import { Command } from "https://dotland.deno.dev/x/wmill@v1.323.6/deps.ts";

Throw validation errors instead of calling Deno.exit() to handle validation errors manually.

A validation error is thrown when the command is wrongly used by the user. For example: If the user passes some invalid options or arguments to the command.

This has no effect for parent commands. Only for the command on which this method was called and all child commands.

Example:

import { Command, ValidationError } from "./mod.ts";

const cmd = new Command();
// ...

try {
  cmd.parse();
} catch(error) {
  if (error instanceof ValidationError) {
    cmd.showHelp();
    Deno.exit(1);
  }
  throw error;
}