Skip to content

Commit

Permalink
Merge pull request #366 from kaspertygesen/master
Browse files Browse the repository at this point in the history
Make exceptions constructors public to enable mocking
  • Loading branch information
ColinSullivan1 authored Feb 26, 2020
2 parents 3558232 + b810c7f commit 0ed68c3
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions src/NATS.Client/Exceptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,18 @@ namespace NATS.Client
/// </summary>
public class NATSException : Exception
{
internal NATSException() : base() { }
internal NATSException(string err) : base (err) {}
internal NATSException(string err, Exception innerEx) : base(err, innerEx) { }
public NATSException() : base() { }
public NATSException(string err) : base (err) {}
public NATSException(string err, Exception innerEx) : base(err, innerEx) { }
}

/// <summary>
/// The exception that is thrown when there is a connection error.
/// </summary>
public class NATSConnectionException : NATSException
{
internal NATSConnectionException(string err) : base(err) { }
internal NATSConnectionException(string err, Exception innerEx) : base(err, innerEx) { }
public NATSConnectionException(string err) : base(err) { }
public NATSConnectionException(string err, Exception innerEx) : base(err, innerEx) { }
}

internal static class NATSConnectionExceptionExtensions
Expand All @@ -50,7 +50,7 @@ internal static bool IsAuthenticationExpiredError(this NATSConnectionException e
/// </summary>
public class NATSReconnectBufferException : NATSConnectionException
{
internal NATSReconnectBufferException(string err) : base(err) { }
public NATSReconnectBufferException(string err) : base(err) { }
}

/// <summary>
Expand All @@ -59,7 +59,7 @@ internal NATSReconnectBufferException(string err) : base(err) { }
/// </summary>
public class NATSProtocolException : NATSException
{
internal NATSProtocolException(string err) : base(err) { }
public NATSProtocolException(string err) : base(err) { }
}

/// <summary>
Expand All @@ -68,7 +68,7 @@ internal NATSProtocolException(string err) : base(err) { }
/// </summary>
public class NATSNoServersException : NATSException
{
internal NATSNoServersException(string err) : base(err) { }
public NATSNoServersException(string err) : base(err) { }
}

/// <summary>
Expand All @@ -77,16 +77,16 @@ internal NATSNoServersException(string err) : base(err) { }
/// </summary>
public class NATSSecureConnWantedException : NATSException
{
internal NATSSecureConnWantedException() : base("A secure connection is requested.") { }
public NATSSecureConnWantedException() : base("A secure connection is requested.") { }
}

/// <summary>
/// The exception that is thrown when a secure connection is required.
/// </summary>
public class NATSSecureConnRequiredException : NATSException
{
internal NATSSecureConnRequiredException() : base("A secure connection is required.") { }
internal NATSSecureConnRequiredException(String s) : base(s) { }
public NATSSecureConnRequiredException() : base("A secure connection is required.") { }
public NATSSecureConnRequiredException(String s) : base(s) { }
}

/// <summary>
Expand All @@ -95,15 +95,15 @@ internal NATSSecureConnRequiredException(String s) : base(s) { }
/// </summary>
public class NATSConnectionClosedException : NATSException
{
internal NATSConnectionClosedException() : base("Connection is closed.") { }
public NATSConnectionClosedException() : base("Connection is closed.") { }
}

/// <summary>
/// The exception that is thrown when a consumer (subscription) is slow.
/// </summary>
public class NATSSlowConsumerException : NATSException
{
internal NATSSlowConsumerException() : base("Consumer is too slow.") { }
public NATSSlowConsumerException() : base("Consumer is too slow.") { }
}

/// <summary>
Expand All @@ -112,7 +112,7 @@ internal NATSSlowConsumerException() : base("Consumer is too slow.") { }
/// </summary>
public class NATSStaleConnectionException : NATSException
{
internal NATSStaleConnectionException() : base("Connection is stale.") { }
public NATSStaleConnectionException() : base("Connection is stale.") { }
}

/// <summary>
Expand All @@ -121,8 +121,8 @@ internal NATSStaleConnectionException() : base("Connection is stale.") { }
/// </summary>
public class NATSMaxPayloadException : NATSException
{
internal NATSMaxPayloadException() : base("Maximum payload size has been exceeded") { }
internal NATSMaxPayloadException(string err) : base(err) { }
public NATSMaxPayloadException() : base("Maximum payload size has been exceeded") { }
public NATSMaxPayloadException(string err) : base(err) { }
}

/// <summary>
Expand All @@ -131,7 +131,7 @@ internal NATSMaxPayloadException(string err) : base(err) { }
/// </summary>
public class NATSMaxMessagesException : NATSException
{
internal NATSMaxMessagesException() : base("Maximum number of messages have been exceeded.") { }
public NATSMaxMessagesException() : base("Maximum number of messages have been exceeded.") { }
}

/// <summary>
Expand All @@ -140,24 +140,24 @@ internal NATSMaxMessagesException() : base("Maximum number of messages have been
/// </summary>
public class NATSBadSubscriptionException : NATSException
{
internal NATSBadSubscriptionException() : base("Subscription is not valid.") { }
internal NATSBadSubscriptionException(string s) : base(s) { }
public NATSBadSubscriptionException() : base("Subscription is not valid.") { }
public NATSBadSubscriptionException(string s) : base(s) { }
}

/// <summary>
/// The exception that is thrown when a NATS operation times out.
/// </summary>
public class NATSTimeoutException : NATSException
{
internal NATSTimeoutException() : base("Timeout occurred.") { }
internal NATSTimeoutException(String s) : base(s) { }
public NATSTimeoutException() : base("Timeout occurred.") { }
public NATSTimeoutException(String s) : base(s) { }
}

/// <summary>
/// The exception that is thrown when a NATS operation is performed on a draining connection.
/// </summary>
public class NATSConnectionDrainingException : NATSConnectionException
{
internal NATSConnectionDrainingException() : base("Connection is draining.") { }
public NATSConnectionDrainingException() : base("Connection is draining.") { }
}
}

0 comments on commit 0ed68c3

Please sign in to comment.