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: (this, 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​

• this: ExceptionFormatting

• err: Error

• ansiColor: boolean

Returns​

string

Inherited from​

CommandErrorFormatting.commandErrorResult

Defined in​

packages/core/src/text.ts:179


exceptionWhileLoadingCommandContext()​

readonly exceptionWhileLoadingCommandContext: (this, 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​

• this: ExceptionFormatting

• exc: unknown

• ansiColor: boolean

Returns​

string

Inherited from​

CommandErrorFormatting.exceptionWhileLoadingCommandContext

Defined in​

packages/core/src/text.ts:159


exceptionWhileLoadingCommandFunction()​

readonly exceptionWhileLoadingCommandFunction: (this, 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​

• this: ExceptionFormatting

• exc: unknown

• ansiColor: boolean

Returns​

string

Inherited from​

CommandErrorFormatting.exceptionWhileLoadingCommandFunction

Defined in​

packages/core/src/text.ts:147


exceptionWhileParsingArguments()​

readonly exceptionWhileParsingArguments: (this, 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​

• this: ExceptionFormatting

• exc: unknown

• ansiColor: boolean

Returns​

string

Inherited from​

CommandErrorFormatting.exceptionWhileParsingArguments

Defined in​

packages/core/src/text.ts:139


exceptionWhileRunningCommand()​

readonly exceptionWhileRunningCommand: (this, 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​

• this: ExceptionFormatting

• exc: unknown

• ansiColor: boolean

Returns​

string

Inherited from​

CommandErrorFormatting.exceptionWhileRunningCommand

Defined in​

packages/core/src/text.ts:171


exceptionWhileRunningIntegrationFlag()​

readonly exceptionWhileRunningIntegrationFlag: (this, args) => string

Formatted error message for the case where some exception was thrown while running an integration flag.

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​

• this: ExceptionFormatting

• args

• args.ansiColor: boolean

• args.exception: unknown

• args.integration: string

Returns​

string

Defined in​

packages/core/src/text.ts:232


exceptionWhileRunningIntegrationHook()​

readonly exceptionWhileRunningIntegrationHook: (this, args) => 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​

• this: ExceptionFormatting

• args

• args.ansiColor: boolean

• args.exception: unknown

• args.hook: string

• args.integration: string

Returns​

string

Defined in​

packages/core/src/text.ts:217


formatException()?​

readonly optional formatException: (exc) => string

Formatted message to display this thrown exception in the terminal. The default behavior returns the stack property if the object extends from Error, and otherwise calls String().

This method should never throw and should not include any ANSI terminal codes in the resulting string.

Parameters​

• exc: unknown

Returns​

string

Inherited from​

CommandErrorFormatting.formatException

Defined in​

packages/core/src/text.ts:122


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:193


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:205