Skip to content

Commit

Permalink
RavenDB-549. Added 'happy error message' for could not connect to rem…
Browse files Browse the repository at this point in the history
…ote server exception
  • Loading branch information
ppekrol committed Oct 31, 2012
1 parent 187f63a commit e6af5da
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Raven.Smuggler/Program.cs
Expand Up @@ -13,6 +13,8 @@

namespace Raven.Smuggler
{
using System.Net.Sockets;

public class Program
{
private readonly RavenConnectionStringOptions connectionStringOptions;
Expand Down Expand Up @@ -132,6 +134,19 @@ private void Parse(string[] args)
}
catch (WebException e)
{
if (e.Status == WebExceptionStatus.ConnectFailure)
{
Console.WriteLine("Error: {0} {1}", e.Message, connectionStringOptions.Url);
var socketException = e.InnerException as SocketException;
if (socketException != null)
{
Console.WriteLine("Details: {0}", socketException.Message);
Console.WriteLine("Socket Error Code: {0}", socketException.SocketErrorCode);
}

Environment.Exit((int)e.Status);
}

var httpWebResponse = e.Response as HttpWebResponse;
if (httpWebResponse == null)
throw;
Expand Down

0 comments on commit e6af5da

Please sign in to comment.