Class ErrorService

The base service that handles any errors.

Hierarchy

  • ErrorService

Implements

Constructors

Properties

DEFAULT_ERROR_MESSAGE: "Unknown error" = 'Unknown error'

Error message used when the specific error type is not defined in the required enums.

Methods

  • Retrieves the API error message based on the provided error code.

    Parameters

    • errorCode: number

      The error code.

    Returns string

    The API error message.

  • Retrieves the response data from the given error.

    Parameters

    • error: AxiosError<unknown, any>

      The error object.

    Returns AxiosResponse<any, any>

    The response data.

    Throws

    The original error if it is not an HTTP error with a response.

  • Retrieves the API error code from the Axios response data.

    Parameters

    • response: AxiosResponse<any, any>

      The response object received.

    Returns undefined | number

    The error code, or undefined if not found.

  • Retrieves the HTTP error message based on the provided HTTP status.

    Parameters

    • httpStatus: number

      The HTTP status code.

    Returns string

    The HTTP error message.

  • Handles API error in a response.

    Parameters

    • response: AxiosResponse<any, any>

      The response object received.

    Returns void

    Throws

    An error with the corresponding API error message if any API-related error has occurred.

  • Handles HTTP error in a response.

    Parameters

    • response: AxiosResponse<any, any>

      The response object received.

    Returns void

    Throws

    An error with the corresponding HTTP status text if any HTTP-related error has occurred.

  • Handles exceeded timeout, configured in RettiwtConfig.

    Parameters

    • error: AxiosError<unknown, any>

      The error object.

    Returns void

    Throws

    An error if the configured request timeout has been exceeded.

Generated using TypeDoc