Skip to content

Commit b3840a9

Browse files
authored
Merge pull request #1443 from rabbitmq/rabbitmq-dotnet-client-1434-followup
Follow-up to #1434
2 parents 4cb93ed + 6b804aa commit b3840a9

File tree

3 files changed

+18
-9
lines changed

3 files changed

+18
-9
lines changed

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

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

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

7078
/// <summary>

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ public void MainLoop()
543543
// Possible heartbeat exception
544544
var ea = new ShutdownEventArgs(ShutdownInitiator.Library,
545545
0, "End of stream",
546-
cause: null, exception: eose);
546+
exception: eose);
547547
HandleMainLoopException(ea);
548548
}
549549
catch (HardProtocolException hpe)
@@ -558,15 +558,15 @@ public void MainLoop()
558558
*/
559559
var ea = new ShutdownEventArgs(ShutdownInitiator.Library,
560560
Constants.InternalError, fileLoadException.Message,
561-
cause: null, exception: fileLoadException);
561+
exception: fileLoadException);
562562
HandleMainLoopException(ea);
563563
}
564564
catch (Exception ex)
565565
{
566566
var ea = new ShutdownEventArgs(ShutdownInitiator.Library,
567567
Constants.InternalError,
568568
$"Unexpected Exception: {ex.Message}",
569-
cause: null, exception: ex);
569+
exception: ex);
570570
HandleMainLoopException(ea);
571571
}
572572

projects/Unit/APIApproval.Approve.verified.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -609,8 +609,9 @@ namespace RabbitMQ.Client
609609
}
610610
public class ShutdownEventArgs : System.EventArgs
611611
{
612-
public ShutdownEventArgs(RabbitMQ.Client.ShutdownInitiator initiator, ushort replyCode, string replyText, object cause = null, System.Exception exception = null) { }
613-
public ShutdownEventArgs(RabbitMQ.Client.ShutdownInitiator initiator, ushort replyCode, string replyText, ushort classId, ushort methodId, object cause = null, System.Exception exception = null) { }
612+
public ShutdownEventArgs(RabbitMQ.Client.ShutdownInitiator initiator, ushort replyCode, string replyText, System.Exception exception) { }
613+
public ShutdownEventArgs(RabbitMQ.Client.ShutdownInitiator initiator, ushort replyCode, string replyText, object cause = null) { }
614+
public ShutdownEventArgs(RabbitMQ.Client.ShutdownInitiator initiator, ushort replyCode, string replyText, ushort classId, ushort methodId, object cause = null) { }
614615
public object Cause { get; }
615616
public ushort ClassId { get; }
616617
public System.Exception Exception { get; }

0 commit comments

Comments
 (0)