using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Configuration;
using System.Runtime.Serialization;
using Microsoft.Http;
using System.Runtime.Serialization.Json;
public class RestServiceUtil
{
public static void HandleHTTPErrorCode(HttpResponseMessage response)
{
if (response.StatusCode == System.Net.HttpStatusCode.OK)
return;
if (response.StatusCode == System.Net.HttpStatusCode.BadRequest)
{
string content = response.Content.ReadAsString().Replace("\"", "");
if (content.StartsWith("BRE_"))
throw new ScrumFactory.Exceptions.BusinessRuleViolationException(content);
}
throw new Exceptions.ServerErrorException();
}
}