GetEwsHttpWebResponse method

Future<IEwsHttpWebResponse> GetEwsHttpWebResponse(
  1. IEwsHttpWebRequest request
)
Gets the IEwsHttpWebRequest object from the specified IEwsHttpWebRequest object with exception handling The specified IEwsHttpWebRequest

Implementation

Future<IEwsHttpWebResponse> GetEwsHttpWebResponse(
  IEwsHttpWebRequest request,
) async {
  try {
    IEwsHttpWebResponse response = await request.GetResponse();
    return response;
  } on WebException catch (ex, stacktrace) {
    if (ex.Status == WebExceptionStatus.ProtocolError) {
      await _ProcessWebException(ex);
    }

    // Wrap exception if the above code block didn't throw
    throw ServiceRequestException(
      "Strings.ServiceRequestFailed($ex)",
      ex,
      stacktrace,
    );
  } on IOException catch (ex, stacktrace) {
    // Wrap exception.
    throw ServiceRequestException(
      "ServiceRequestFailed($ex)",
      ex,
      stacktrace,
    );
  }
}