• Version 1.3.6
  • Published
  • 18.8 kB
  • 5 dependencies
  • MIT license


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


display friendly CLI errors and log to error log



variable config

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


    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;


            class CLIError

            class CLIError extends Error implements OclifError {}


              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(exitCode?: number);

                            property code

                            code: string;

                              property oclif

                              oclif: { exit: number };

                                method render

                                render: () => string;

                                  class Logger

                                  class Logger {}


                                    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;


                                                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


                                                  namespace CLIError

                                                  namespace CLIError {}

                                                    class Warn

                                                    class Warn extends CLIError {}


                                                      constructor(err: string | Error);

                                                        property bang

                                                        readonly bang: string;

                                                          Package Files (7)

                                                          Dependencies (5)

                                                          Dev Dependencies (18)

                                                          Peer Dependencies (0)

                                                          No peer dependencies.


                                                          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
                                                          • 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>