Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Better errors when we get smuggler web exception

  • Loading branch information...
commit 46843d0886956a362c52dc1f41e1db0cdffd64d4 1 parent 08b2cf8
@ayende ayende authored
Showing with 19 additions and 0 deletions.
  1. +19 −0 Raven.Smuggler/Program.cs
View
19 Raven.Smuggler/Program.cs
@@ -124,6 +124,25 @@ private void Parse(string[] args)
break;
}
}
+ catch (WebException e)
+ {
+ var httpWebResponse = e.Response as HttpWebResponse;
+ if (httpWebResponse == null)
+ throw;
+ Console.WriteLine("Error: " + e.Message);
+ Console.WriteLine("Http Status Code: " + httpWebResponse.StatusCode + " " + httpWebResponse.StatusDescription);
+
+ using (var reader = new StreamReader(httpWebResponse.GetResponseStream()))
+ {
+ string line;
+ while ((line = reader.ReadLine()) != null)
+ {
+ Console.WriteLine(line);
+ }
+ }
+
+ Environment.Exit((int)httpWebResponse.StatusCode);
+ }
catch (Exception e)
{
Console.WriteLine(e);
Please sign in to comment.
Something went wrong with that request. Please try again.