addError method

void addError(
  1. InfospectNetworkError error,
  2. int requestId
)

Logs an error associated with a specific network request.

  • error: The network error to be logged.
  • requestId: The unique identifier of the associated request.

Implementation

void addError(InfospectNetworkError error, int requestId) {
  final int index = _selectCall(requestId);

  if (index == -1) {
    InfospectUtil.log("Selected call is null");
    return;
  }

  final InfospectNetworkCall selectedCall =
      _infospect.networkCallsSubject.value[index];
  _infospect.networkCallsSubject.value[index] =
      selectedCall.copyWith(error: error, loading: false);
  _infospect.networkCallsSubject
      .add([..._infospect.networkCallsSubject.value]);
  _infospect.sendNetworkCalls();
}