private void ErrorHandling(IRestResponse response) { var xml = new XmlDeserializer(); var output = xml.Deserialize <AlexaError>(response); if (output != null && output.Errors.Count > 0 && !string.IsNullOrWhiteSpace(output.RequestID.Value)) { LastError = output; } }
private T Execute <T>(RestRequest request) where T : new() { LastError = null; var client = new RestClient(baseUrl); var response = client.Execute <T>(request); if (response.ErrorException != null) { throw response.ErrorException; } if (response.StatusCode != HttpStatusCode.OK) { throw new WebException( string.Format("Alexa Error. Status code: {0}; description: {1}. Please review AlexaClient.LastError property for detailed information.", response.StatusCode, response.StatusDescription)); } return(response.Data); }