/// <summary> /// Constructor /// </summary> /// <param name="errorResponse">The response that caused the exception</param> /// <param name="wex">The original web exception. This becomes the inner exception of ths exception</param> public ChargifyException(HttpWebResponse errorResponse, WebException wex) : base(string.Format("The server returned '{0}' with the status code {1} ({1:d}).", errorResponse.StatusDescription, errorResponse.StatusCode), wex) { _statusDescription = errorResponse.StatusDescription; _statusCode = errorResponse.StatusCode; // if there are any errors, parse them for user consumption _errors = ChargifyError.ParseChargifyErrors(errorResponse); }
/// <summary> /// Constructor /// </summary> /// <param name="errorResponse">The response that caused the exception</param> /// <param name="wex">The original web exception. This becomes the inner exception of ths exception</param> public ChargifyException(HttpWebResponse errorResponse, WebException wex) : base($"The server returned '{errorResponse.StatusDescription}' with the status code {errorResponse.StatusCode} ({errorResponse.StatusCode:d}).", wex) { StatusDescription = errorResponse.StatusDescription; StatusCode = errorResponse.StatusCode; // if there are any errors, parse them for user consumption ErrorMessages = ChargifyError.ParseChargifyErrors(errorResponse); }