private T handleResponse()

in src/main/java/com/microsoft/store/partnercenter/network/PartnerServiceClient.java [570:615]


	private <T> T handleResponse(IPartner rootPartnerOperations, Request request, TypeReference<T> responseType)
	{
		Response response; 
		String responseBody = null; 
		T value; 

		try
		{
			response = httpClient().newCall(request).execute();
		
			if(response.isSuccessful())
			{
				responseBody = response.body().string();

				if(StringHelper.isNullOrEmpty(responseBody))
				{
					value = (T)response;
				}
				else
				{
					value = getJsonConverter().readValue(responseBody, responseType);
				}

				response.close();
				return value; 
			}

			throw errorHandler.handleFailedResponse(response, rootPartnerOperations.getRequestContext());
		}
		catch (SocketTimeoutException ex)
		{
			throw new PartnerException(
					"Socket timeout exception",
					rootPartnerOperations.getRequestContext(),
					PartnerErrorCategory.TIMEOUT,
					ex);
		}
		catch (IOException ex) 
		{
			throw new PartnerResponseParseException(
				responseBody, 
				rootPartnerOperations.getRequestContext(), 
				"Could not deserialize response. Detailed message: " + ex.getMessage(),
				ex);
		}
	}