Function getErrorMessage

  • Attempts to obtain the message from a possible error object, defaulting to an empty string if it is impossible to do so.

    Returns

    The message if error is an object with a message property; the string version of error if it is not undefined or null; otherwise an empty string.

    Parameters

    • error: unknown

      The possible error to get the message from.

    Returns string