Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/alloy_folk/deps.ts>cliffy.Command#throwErrors

An application installer for restriced macOS
Go to Latest
method cliffy.Command.prototype.throwErrors
Re-export
import { cliffy } from "https://deno.land/x/alloy_folk@v1.1.1/deps.ts";
const { Command } = cliffy;

Throw validation error's instead of calling Deno.exit() to handle validation error's 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:

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