@oclif/errors

  • Version 1.3.4
  • Published
  • 24.2 kB
  • 5 dependencies
  • MIT license

Install

npm i @oclif/errors
yarn add @oclif/errors
pnpm add @oclif/errors

Overview

display friendly CLI errors and log to error log

Index

Variables

variable config

const config: {
errorLogger: Logger | undefined;
debug: boolean;
errlog: string | undefined;
};

    Functions

    function error

    error: {
    (input: string | Error, options: { exit: false } & PrettyPrintableError): void;
    (
    input: string | Error,
    options?: { exit?: number } & PrettyPrintableError
    ): never;
    };

      function exit

      exit: (code?: number) => never;

        function handle

        handle: (
        err: Error & Partial<PrettyPrintableError> & Partial<OclifError>
        ) => void;

          function warn

          warn: (input: string | Error) => void;

            Classes

            class CLIError

            class CLIError extends Error implements OclifError {}

              constructor

              constructor(
              error: string | Error,
              options?: { exit?: number | false } & PrettyPrintableError
              );

                property bang

                readonly bang: string;

                  property code

                  code?: string;

                    property oclif

                    oclif: { exit?: number | false };

                      property stack

                      readonly stack: string;

                        method render

                        render: () => string;
                        • Deprecated

                          render Errors display should be handled by display function, like pretty-print {string} returns a string representing the dispay of the error

                        class ExitError

                        class ExitError extends CLIError implements OclifError {}

                          constructor

                          constructor(exitCode?: number);

                            property code

                            code: string;

                              property oclif

                              oclif: { exit: number };

                                method render

                                render: () => string;

                                  class Logger

                                  class Logger {}

                                    constructor

                                    constructor(file: string);

                                      property buffer

                                      protected buffer: string[];

                                        property file

                                        file: string;

                                          property flushing

                                          protected flushing: Promise<void>;

                                            method flush

                                            flush: (waitForMs?: number) => Promise<void>;

                                              method log

                                              log: (msg: string) => void;

                                                Interfaces

                                                interface PrettyPrintableError

                                                interface PrettyPrintableError {}

                                                  property code

                                                  code?: string;
                                                  • a unique error code for this error class

                                                  property message

                                                  message?: string;
                                                  • messsage to display related to the error

                                                  property ref

                                                  ref?: string;
                                                  • a url to find out more information related to this error or fixing the error

                                                  property suggestions

                                                  suggestions?: string[];
                                                  • a suggestion that may be useful or provide additional context

                                                  Namespaces

                                                  namespace CLIError

                                                  namespace CLIError {}

                                                    class Warn

                                                    class Warn extends CLIError {}

                                                      constructor

                                                      constructor(err: string | Error);

                                                        property bang

                                                        readonly bang: string;

                                                          Package Files (7)

                                                          Dependencies (5)

                                                          Dev Dependencies (18)

                                                          Peer Dependencies (0)

                                                          No peer dependencies.

                                                          Badge

                                                          To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                          You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@oclif/errors.

                                                          • Markdown
                                                            [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@oclif/errors)
                                                          • HTML
                                                            <a href="https://www.jsdocs.io/package/@oclif/errors"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>