Function getErrorMessage

  • Function to get an error message from the object (useful for getting error message in a catch block)

    Parameters

    • error: unknown

      Error object whose message to get

    Returns string

    Message of the error - if object has message, returns message. Otherwise tries to stringify

    `try {...} catch (e) { logger.info(getErrorMessage(e)) }`