public async Task<SubmitResponse> SubmitAsync(IEnumerable<SubmitRequest> requests)
{
try
{
using (var body = BuildRequestBody(requests))
{
// If the request contains invalid parameters, the server will return
// "400 Bad Request" and we'll end up in the first catch block.
string response = await WebHelper.SendPost(URL, body, UseCompression);
return parser.ParseSubmitResponse(response);
}
}
catch (WebException e)
{
// Handle bad requests gracefully.
return CreateErrorResponse(e.Response as HttpWebResponse);
}
catch (Exception e)
{
throw e;
}
}