Options
All
  • Public
  • Public/Protected
  • All
Menu

A class to manage all the keys and tokens for a message bundle to use with SfdxError.

example

SfdxError.create(new SfdxErrorConfig('MyPackage', 'apex', 'runTest').addAction('apexErrorAction1', [className]));

Hierarchy

  • SfdxErrorConfig

Index

Constructors

constructor

  • new SfdxErrorConfig(packageName: string, bundleName: string, errorKey: string, errorTokens?: Tokens, actionKey?: undefined | string, actionTokens?: Tokens): SfdxErrorConfig
  • Create a new SfdxErrorConfig.

    Parameters

    • packageName: string

      The name of the package.

    • bundleName: string

      The message bundle.

    • errorKey: string

      The error message key.

    • Default value errorTokens: Tokens = []

      The tokens to use when getting the error message.

    • Optional actionKey: undefined | string
    • Optional actionTokens: Tokens

    Returns SfdxErrorConfig

Properties

bundleName

bundleName: string

The name of the bundle

errorKey

errorKey: string

The error key

packageName

packageName: string

The name of the package

Methods

addAction

  • Add an error action to assist the user with a resolution.

    Parameters

    • actionKey: string

      The action key in the message bundle.

    • Default value actionTokens: Tokens = []

    Returns SfdxErrorConfig

    For convenience this object is returned.

getActions

  • getActions(): Optional<string[]>
  • Get the action messages using messages.getMessage.

    throws

    {SfdxError} If errorMessages.load was not called first.

    Returns Optional<string[]>

    List of action messages.

getError

  • getError(): string
  • Get the error message using messages.getMessage.

    throws

    {SfdxError} If errorMessages.load was not called first.

    Returns string

load

  • Load the messages using Messages.loadMessages.

    Returns Messages

    Returns the loaded messages.

removeActions

  • Remove all actions from this error config. Useful when reusing SfdxErrorConfig. for other error messages within the same bundle.

    Returns SfdxErrorConfig

    For convenience this object is returned.

setErrorKey

  • Set the error key.

    Parameters

    • key: string

      The key to set.

    Returns SfdxErrorConfig

    For convenience this object is returned.

setErrorTokens

  • Set the error tokens.

    Parameters

    • tokens: Tokens

      The tokens to set.

    Returns SfdxErrorConfig

    For convenience this object is returned.