Skip to content

Commit

Permalink
Merge pull request #1443 from rabbitmq/rabbitmq-dotnet-client-1434-fo…
Browse files Browse the repository at this point in the history
…llowup

Follow-up to #1434
  • Loading branch information
lukebakken committed Dec 11, 2023
2 parents 4cb93ed + 6b804aa commit b3840a9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
16 changes: 12 additions & 4 deletions projects/RabbitMQ.Client/client/api/ShutdownEventArgs.cs
Expand Up @@ -47,24 +47,32 @@ public class ShutdownEventArgs : EventArgs
/// Construct a <see cref="ShutdownEventArgs"/> with the given parameters and
/// 0 for <see cref="ClassId"/> and <see cref="MethodId"/>.
/// </summary>
public ShutdownEventArgs(ShutdownInitiator initiator, ushort replyCode, string replyText, object cause = null, Exception exception = null)
: this(initiator, replyCode, replyText, 0, 0, cause, exception)
public ShutdownEventArgs(ShutdownInitiator initiator, ushort replyCode, string replyText, object cause = null)
: this(initiator, replyCode, replyText, 0, 0, cause)
{
}

/// <summary>
/// Construct a <see cref="ShutdownEventArgs"/> with the given parameters.
/// </summary>
public ShutdownEventArgs(ShutdownInitiator initiator, ushort replyCode, string replyText,
ushort classId, ushort methodId, object cause = null, Exception exception = null)
ushort classId, ushort methodId, object cause = null)
{
Initiator = initiator;
ReplyCode = replyCode;
ReplyText = replyText;
ClassId = classId;
MethodId = methodId;
Cause = cause;
_exception = exception;
}

/// <summary>
/// Construct a <see cref="ShutdownEventArgs"/> with the given parameters.
/// </summary>
public ShutdownEventArgs(ShutdownInitiator initiator, ushort replyCode, string replyText, Exception exception)
: this(initiator, replyCode, replyText, 0, 0)
{
_exception = exception ?? throw new ArgumentNullException(nameof(exception));
}

/// <summary>
Expand Down
6 changes: 3 additions & 3 deletions projects/RabbitMQ.Client/client/impl/Connection.cs
Expand Up @@ -543,7 +543,7 @@ public void MainLoop()
// Possible heartbeat exception
var ea = new ShutdownEventArgs(ShutdownInitiator.Library,
0, "End of stream",
cause: null, exception: eose);
exception: eose);
HandleMainLoopException(ea);
}
catch (HardProtocolException hpe)
Expand All @@ -558,15 +558,15 @@ public void MainLoop()
*/
var ea = new ShutdownEventArgs(ShutdownInitiator.Library,
Constants.InternalError, fileLoadException.Message,
cause: null, exception: fileLoadException);
exception: fileLoadException);
HandleMainLoopException(ea);
}
catch (Exception ex)
{
var ea = new ShutdownEventArgs(ShutdownInitiator.Library,
Constants.InternalError,
$"Unexpected Exception: {ex.Message}",
cause: null, exception: ex);
exception: ex);
HandleMainLoopException(ea);
}

Expand Down
5 changes: 3 additions & 2 deletions projects/Unit/APIApproval.Approve.verified.txt
Expand Up @@ -609,8 +609,9 @@ namespace RabbitMQ.Client
}
public class ShutdownEventArgs : System.EventArgs
{
public ShutdownEventArgs(RabbitMQ.Client.ShutdownInitiator initiator, ushort replyCode, string replyText, object cause = null, System.Exception exception = null) { }
public ShutdownEventArgs(RabbitMQ.Client.ShutdownInitiator initiator, ushort replyCode, string replyText, ushort classId, ushort methodId, object cause = null, System.Exception exception = null) { }
public ShutdownEventArgs(RabbitMQ.Client.ShutdownInitiator initiator, ushort replyCode, string replyText, System.Exception exception) { }
public ShutdownEventArgs(RabbitMQ.Client.ShutdownInitiator initiator, ushort replyCode, string replyText, object cause = null) { }
public ShutdownEventArgs(RabbitMQ.Client.ShutdownInitiator initiator, ushort replyCode, string replyText, ushort classId, ushort methodId, object cause = null) { }
public object Cause { get; }
public ushort ClassId { get; }
public System.Exception Exception { get; }
Expand Down

0 comments on commit b3840a9

Please sign in to comment.