Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions projects/RabbitMQ.Client/client/api/ShutdownEventArgs.cs
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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