Skip to content

Commit 93ef996

Browse files
Separate recovery exception event class
1 parent 968d8a1 commit 93ef996

File tree

2 files changed

+71
-17
lines changed

2 files changed

+71
-17
lines changed

projects/client/RabbitMQ.Client/src/client/events/CallbackExceptionEventArgs.cs

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,26 @@
4343

4444
namespace RabbitMQ.Client.Events
4545
{
46+
public abstract class BaseExceptionEventArgs: EventArgs
47+
{
48+
private IDictionary<string, object> m_detail;
49+
private Exception m_exception;
50+
51+
///<summary>Wrap an exception thrown by a callback.</summary>
52+
public BaseExceptionEventArgs(Exception exception)
53+
{
54+
m_detail = new Dictionary<string, object>();
55+
m_exception = exception;
56+
}
57+
58+
///<summary>Access helpful information about the context in
59+
///which the wrapped exception was thrown.</summary>
60+
public IDictionary<string, object> Detail { get { return m_detail; } }
61+
62+
///<summary>Access the wrapped exception.</summary>
63+
public Exception Exception { get { return m_exception; } }
64+
}
65+
4666
///<summary>Describes an exception that was thrown during the
4767
///library's invocation of an application-supplied callback
4868
///handler.</summary>
@@ -63,23 +83,8 @@ namespace RabbitMQ.Client.Events
6383
/// call in the IDictionary available through the Detail property.
6484
///</para>
6585
///</remarks>
66-
public class CallbackExceptionEventArgs: EventArgs
86+
public class CallbackExceptionEventArgs: BaseExceptionEventArgs
6787
{
68-
private IDictionary<string, object> m_detail;
69-
private Exception m_exception;
70-
71-
///<summary>Wrap an exception thrown by a callback.</summary>
72-
public CallbackExceptionEventArgs(Exception exception)
73-
{
74-
m_detail = new Dictionary<string, object>();
75-
m_exception = exception;
76-
}
77-
78-
///<summary>Access helpful information about the context in
79-
///which the wrapped exception was thrown.</summary>
80-
public IDictionary<string, object> Detail { get { return m_detail; } }
81-
82-
///<summary>Access the wrapped exception.</summary>
83-
public Exception Exception { get { return m_exception; } }
88+
public CallbackExceptionEventArgs(Exception e) : base(e) {}
8489
}
8590
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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-2014 GoPivotal, 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 GoPivotal, Inc.
38+
// Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved.
39+
//---------------------------------------------------------------------------
40+
41+
using System;
42+
43+
namespace RabbitMQ.Client.Events
44+
{
45+
public class RecoveryExceptionEventArgs: BaseExceptionEventArgs
46+
{
47+
public RecoveryExceptionEventArgs(Exception e) : base(e) {}
48+
}
49+
}

0 commit comments

Comments
 (0)