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 &&
        ex.Response != null) {
      await this._ProcessWebException(ex);
    }

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