Skip to content

Commit f02b423

Browse files
author
Tim Watson
committed
merge bug23747 into default
2 parents 24faf78 + c571aa6 commit f02b423

File tree

2 files changed

+60
-1
lines changed

2 files changed

+60
-1
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// This source code is dual-licensed under the Apache License, version
2+
// 2.0, and the Mozilla Public License, version 1.1.
3+
//
4+
// The APL v2.0:
5+
//
6+
//---------------------------------------------------------------------------
7+
// Copyright (C) 2007-2012 VMware, Inc.
8+
//
9+
// Licensed under the Apache License, Version 2.0 (the "License");
10+
// you may not use this file except in compliance with the License.
11+
// You may obtain a copy of the License at
12+
//
13+
// http://www.apache.org/licenses/LICENSE-2.0
14+
//
15+
// Unless required by applicable law or agreed to in writing, software
16+
// distributed under the License is distributed on an "AS IS" BASIS,
17+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18+
// See the License for the specific language governing permissions and
19+
// limitations under the License.
20+
//---------------------------------------------------------------------------
21+
//
22+
// The MPL v1.1:
23+
//
24+
//---------------------------------------------------------------------------
25+
// The contents of this file are subject to the Mozilla Public License
26+
// Version 1.1 (the "License"); you may not use this file except in
27+
// compliance with the License. You may obtain a copy of the License
28+
// at http://www.mozilla.org/MPL/
29+
//
30+
// Software distributed under the License is distributed on an "AS IS"
31+
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
32+
// the License for the specific language governing rights and
33+
// limitations under the License.
34+
//
35+
// The Original Code is RabbitMQ.
36+
//
37+
// The Initial Developer of the Original Code is VMware, Inc.
38+
// Copyright (c) 2007-2012 VMware, Inc. All rights reserved.
39+
//---------------------------------------------------------------------------
40+
41+
using System;
42+
43+
namespace RabbitMQ.Client.Exceptions {
44+
/// <summary>Thrown when a connection to the broker fails</summary>
45+
public class ConnectFailureException: SystemException
46+
{
47+
public ConnectFailureException(String msg, Exception inner)
48+
: base(msg, inner) { }
49+
}
50+
}

projects/client/RabbitMQ.Client/src/client/impl/SocketFrameHandler_0_9.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
using System.Text;
4545

4646
using RabbitMQ.Util;
47+
using RabbitMQ.Client.Exceptions;
4748

4849
namespace RabbitMQ.Client.Impl
4950
{
@@ -75,7 +76,7 @@ public SocketFrameHandler_0_9(AmqpTcpEndpoint endpoint,
7576
m_socket = socketFactory(AddressFamily.InterNetworkV6);
7677
Connect(m_socket, endpoint, timeout);
7778
}
78-
catch (ArgumentException) // could not connect using IPv6
79+
catch (ConnectFailureException) // could not connect using IPv6
7980
{
8081
m_socket = null;
8182
}
@@ -116,6 +117,14 @@ private void Connect(TcpClient socket, AmqpTcpEndpoint endpoint, int timeout)
116117
}
117118
socket.EndConnect(ar);
118119
}
120+
catch (ArgumentException e)
121+
{
122+
throw new ConnectFailureException("Connection failed", e);
123+
}
124+
catch (SocketException e)
125+
{
126+
throw new ConnectFailureException("Connection failed", e);
127+
}
119128
finally
120129
{
121130
if (ar != null)

0 commit comments

Comments
 (0)