Skip to content

Commit 78d0d97

Browse files
committed
Port changes from #1443
1 parent 1c38b66 commit 78d0d97

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

projects/RabbitMQ.Client/client/api/ShutdownEventArgs.cs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,24 +48,32 @@ public class ShutdownEventArgs : EventArgs
4848
/// 0 for <see cref="ClassId"/> and <see cref="MethodId"/>.
4949
/// </summary>
5050
public ShutdownEventArgs(ShutdownInitiator initiator, ushort replyCode, string replyText,
51-
object cause = null, Exception exception = null)
52-
: this(initiator, replyCode, replyText, 0, 0, cause, exception)
51+
object cause = null)
52+
: this(initiator, replyCode, replyText, 0, 0, cause)
5353
{
5454
}
5555

5656
/// <summary>
5757
/// Construct a <see cref="ShutdownEventArgs"/> with the given parameters.
5858
/// </summary>
5959
public ShutdownEventArgs(ShutdownInitiator initiator, ushort replyCode, string replyText,
60-
ushort classId, ushort methodId, object cause = null, Exception exception = null)
60+
ushort classId, ushort methodId, object cause = null)
6161
{
6262
Initiator = initiator;
6363
ReplyCode = replyCode;
6464
ReplyText = replyText;
6565
ClassId = classId;
6666
MethodId = methodId;
6767
Cause = cause;
68-
_exception = exception;
68+
}
69+
70+
/// <summary>
71+
/// Construct a <see cref="ShutdownEventArgs"/> with the given parameters.
72+
/// </summary>
73+
public ShutdownEventArgs(ShutdownInitiator initiator, ushort replyCode, string replyText, Exception exception)
74+
: this(initiator, replyCode, replyText, 0, 0)
75+
{
76+
_exception = exception ?? throw new ArgumentNullException(nameof(exception));
6977
}
7078

7179
/// <summary>

projects/RabbitMQ.Client/client/impl/Connection.Receive.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ await ReceiveLoop()
5555
// Possible heartbeat exception
5656
var ea = new ShutdownEventArgs(ShutdownInitiator.Library,
5757
0, "End of stream",
58-
cause: null, exception: eose);
58+
exception: eose);
5959
HandleMainLoopException(ea);
6060
}
6161
catch (HardProtocolException hpe)
@@ -71,15 +71,15 @@ await HardProtocolExceptionHandler(hpe)
7171
*/
7272
var ea = new ShutdownEventArgs(ShutdownInitiator.Library,
7373
Constants.InternalError, fileLoadException.Message,
74-
cause: null, exception: fileLoadException);
74+
exception: fileLoadException);
7575
HandleMainLoopException(ea);
7676
}
7777
catch (Exception ex)
7878
{
7979
var ea = new ShutdownEventArgs(ShutdownInitiator.Library,
8080
Constants.InternalError,
8181
$"Unexpected Exception: {ex.Message}",
82-
cause: null, exception: ex);
82+
exception: ex);
8383
HandleMainLoopException(ea);
8484
}
8585

0 commit comments

Comments
 (0)