Skip to main content

Interface: ApplicationErrorFormatting

Methods to customize the formatting of stderr messages handled by application execution.

Extends

  • CommandErrorFormatting

Extended by

Properties

commandErrorResult()

readonly commandErrorResult: (err, ansiColor) => string

Formatted error message for the case where an Error was safely returned from the command. Users are most likely to hit this case, so make sure that the error text provides practical, usable feedback.

If ansiColor is true, this string can use ANSI terminal codes. Codes may have already been applied so be aware you may have to reset to achieve the desired output.

Parameters

err: Error

ansiColor: boolean

Returns

string

Inherited from

CommandErrorFormatting.commandErrorResult

Defined in

packages/core/src/text.ts:152


exceptionWhileLoadingCommandContext()

readonly exceptionWhileLoadingCommandContext: (exc, ansiColor) => string

Formatted error message for the case where some exception was thrown while loading the context for the command run. This likely indicates an issue with the application itself or possibly the user's installation of the application.

If ansiColor is true, this string can use ANSI terminal codes. Codes may have already been applied so be aware you may have to reset to achieve the desired output.

Parameters

exc: unknown

ansiColor: boolean

Returns

string

Inherited from

CommandErrorFormatting.exceptionWhileLoadingCommandContext

Defined in

packages/core/src/text.ts:136


exceptionWhileLoadingCommandFunction()

readonly exceptionWhileLoadingCommandFunction: (exc, ansiColor) => string

Formatted error message for the case where some exception was thrown while loading the command function. This likely indicates an issue with the application itself or possibly the user's installation of the application.

If ansiColor is true, this string can use ANSI terminal codes. Codes may have already been applied so be aware you may have to reset to achieve the desired output.

Parameters

exc: unknown

ansiColor: boolean

Returns

string

Inherited from

CommandErrorFormatting.exceptionWhileLoadingCommandFunction

Defined in

packages/core/src/text.ts:128


exceptionWhileParsingArguments()

readonly exceptionWhileParsingArguments: (exc, ansiColor) => string

Formatted error message for the case where some exception was thrown while parsing the arguments.

Exceptions intentionally thrown by this library while parsing arguments will extend from ArgumentScannerError. These subclasses provide additional context about the specific error. Use the formatMessageForArgumentScannerError helper to handle the different error types.

If ansiColor is true, this string can use ANSI terminal codes. Codes may have already been applied so be aware you may have to reset to achieve the desired output.

Parameters

exc: unknown

ansiColor: boolean

Returns

string

Inherited from

CommandErrorFormatting.exceptionWhileParsingArguments

Defined in

packages/core/src/text.ts:120


exceptionWhileRunningCommand()

readonly exceptionWhileRunningCommand: (exc, ansiColor) => string

Formatted error message for the case where some exception was thrown while running the command. Users are most likely to hit this case, so make sure that the error text provides practical, usable feedback.

If ansiColor is true, this string can use ANSI terminal codes. Codes may have already been applied so be aware you may have to reset to achieve the desired output.

Parameters

exc: unknown

ansiColor: boolean

Returns

string

Inherited from

CommandErrorFormatting.exceptionWhileRunningCommand

Defined in

packages/core/src/text.ts:144


noCommandRegisteredForInput()

readonly noCommandRegisteredForInput: (args) => string

Formatted error message for the case where the supplied command line inputs do not resolve to a registered command. Supplied with arguments for the argument in question, and several possible corrections based on registered commands.

If ansiColor is true, this string can use ANSI terminal codes. Codes may have already been applied so be aware you may have to reset to achieve the desired output.

Parameters

args

args.ansiColor: boolean

args.corrections: readonly string[]

args.input: string

Returns

string

Defined in

packages/core/src/text.ts:166


noTextAvailableForLocale()

readonly noTextAvailableForLocale: (args) => string

Formatted error message for the case where the application does not provide text for the current requested locale. Should indicate that the default locale will be used instead.

If ansiColor is true, this string can use ANSI terminal codes. Codes may have already been applied so be aware you may have to reset to achieve the desired output.

Parameters

args

args.ansiColor: boolean

args.defaultLocale: string

args.requestedLocale: string

Returns

string

Defined in

packages/core/src/text.ts:178