Parses an error response from an API and formats it into a standard structure.

This function takes an error object and extracts relevant information to return an ESPAPIError object.

  • Parameters

    • error: any

      The error object to parse.

    • statusCode: number

    Returns ESPAPIError

    An object representing the error response with the following properties:

    • status: A string indicating the status ("failure").
    • statusCode: The HTTP status code from the error response.
    • errorCode: A specific error code if available from the response.
    • description: A description of the error.