Skip to main content
Module

x/drollup/deps.ts>Command#throwErrors

Next-generation ES module bundler ported for Deno
Latest
method Command.prototype.throwErrors
Re-export
import { Command } from "https://deno.land/x/drollup@2.58.0%2B0.20.0/deps.ts";

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;
}