Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SfdxErrorConfig

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

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

      The action message key.

    • Optional actionTokens: Tokens

      The tokens to use when getting the action message(s).

    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. For convenience this object is returned.

    Parameters

    • actionKey: string

      The action key in the message bundle.

    • Default value actionTokens: Tokens = []

      The action tokens for the string.

    Returns SfdxErrorConfig

getActions

  • getActions(): Optional<string[]>
  • Get the action messages using messages.getMessage. @throws If errorMessages.load was not called first.

    Returns Optional<string[]>

getError

  • getError(): string
  • Get the error message using messages.getMessage. Throws If errorMessages.load was not called first.

    Returns string

load

  • Load the messages using Messages.loadMessages. Returns the loaded messages.

    Returns Messages

removeActions

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

    Returns SfdxErrorConfig

setErrorKey

  • Set the error key.

    Parameters

    • key: string

      The key to set.

    Returns SfdxErrorConfig

    For convenience this object is returned.

setErrorTokens