Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/ndeno/src/deps.ts>Command#throwErrors

Command line tool created by deno to manage node projects | deno 实现的 node 项目包管理命令工具
Go to Latest
method Command.prototype.throwErrors
Re-export
import { Command } from "https://deno.land/x/ndeno@v1.3.1/src/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:

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