private static async Task CheckError(HttpResponseMessage response) { if (response.StatusCode != HttpStatusCode.OK && response.StatusCode != HttpStatusCode.Created && response.StatusCode != HttpStatusCode.Accepted && response.StatusCode != HttpStatusCode.NonAuthoritativeInformation && response.StatusCode != HttpStatusCode.NoContent) { var mes = await response.Content.ReadAsStringAsync(); var apiError = BacklogApiError.Decode(mes); throw new BacklogApiException("backlog api request failed.", (int)response.StatusCode, apiError); } }
public BacklogApiException(string message, int statusCode, BacklogApiError apiError) : base(message) { this.StatusCode = statusCode; this.BacklogApiError = apiError; }