Esempio n. 1
0
        private static async Task <TResult> HandleResponseAsync <TResult>(HttpResponseMessage response)
        {
            if (!response.IsSuccessStatusCode)
            {
                PlaidErrorResponse error = await response.Content.ReadAsJsonAsync <PlaidErrorResponse>();

                throw new PlaidException(error);
            }

            TResult result = await response.Content.ReadAsJsonAsync <TResult>();

            PlaidResponse plaidResponse = result as PlaidResponse;

            if (plaidResponse != null)
            {
                plaidResponse.StatusCode = response.StatusCode;
            }

            return(result);
        }
Esempio n. 2
0
 public PlaidException(PlaidErrorResponse error)
     : base(error.ToString())
 {
     this.Error = error;
 }