private static CulqiException BuildCulqiException(CulqiResponse response) { CulqiError error = null; try { error = JsonConvert.DeserializeObject <CulqiError>(response.Content); } catch (Newtonsoft.Json.JsonException) { return(BuildInvalidResponseException(response)); } if (error == null) { return(BuildInvalidResponseException(response)); } var culqiError = CulqiError.FromJson(response.Content); culqiError.CulqiResponse = response; return(new CulqiException(response.StatusCode, culqiError, culqiError.Message ?? culqiError.UserMessage) { CulqiResponse = response }); }
public CulqiException(HttpStatusCode httpStatusCode, CulqiError CulqiError, string message) : base(message) { this.HttpStatusCode = httpStatusCode; this.CulqiError = CulqiError; }