示例#1
0
        public async Task <MType> ProcessResponse <MType>(IResponse response)
        {
            if (!response.IsSuccessful)
            {
                var rawErrors = await response.GetRawContent();

                System.Exception ex;
                try
                {
                    ex = exceptionFactory.CreateApiException(response.GetAPIFormat(), rawErrors, response);
                }
                catch (System.Exception e)
                {
                    var innerEx = new System.Exception("Error response is " + rawErrors, e);
                    throw new Base.Exception.InvalidValueException("Unexspect ", innerEx);
                }

                throw ex;
            }
            string content = await response.GetRawContent();

            var serializer = SerializerFactory.GetSerializer(response.GetAPIFormat());

            return(serializer.Deserialize <MType>(content));
        }