Browse files

Handle Forbidden status codes from Cloud Foundry

  • Loading branch information...
1 parent 32cfa1c commit 1187566ba6e137e08229797d0299dc6a5605f7eb @SaintGimp SaintGimp committed Jul 26, 2012
Showing with 6 additions and 3 deletions.
  1. +6 −3 src/IronFoundry/Vcap/VcapRequest.cs
View
9 src/IronFoundry/Vcap/VcapRequest.cs
@@ -183,19 +183,22 @@ private void ProcessResponse(IRestResponse response)
}
}
- if (null != parseException)
+ if (parseException != null)
{
errorMessage = String.Format("Error parsing (HTTP {0}):{1}{2}{3}{4}",
response.StatusCode, Environment.NewLine, response.Content, Environment.NewLine, parseException.Message);
throw new VcapException(errorMessage, parseException);
}
else
{
- if (response.StatusCode == HttpStatusCode.BadRequest ||
- response.StatusCode == HttpStatusCode.NotFound)
+ if (response.StatusCode == HttpStatusCode.BadRequest || response.StatusCode == HttpStatusCode.NotFound)
{
throw new VcapNotFoundException(errorMessage);
}
+ else if (response.StatusCode == HttpStatusCode.Forbidden)
+ {
+ throw new VcapAuthException(errorMessage);
+ }
else
{
throw new VcapException(errorMessage);

0 comments on commit 1187566

Please sign in to comment.