Skip to content

Commit 83732d3

Browse files
authored
Rename Throw (#350)
* throw * debug ---------
1 parent 7a5bf5b commit 83732d3

22 files changed

+45
-45
lines changed

BitFaster.Caching/Atomic/AtomicFactoryAsyncCache.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public AtomicFactoryAsyncCache(ICache<K, AsyncAtomicFactory<K, V>> cache)
2727
{
2828
if (cache == null)
2929
{
30-
Ex.ThrowArgNull(ExceptionArgument.cache);
30+
Throw.ArgNull(ExceptionArgument.cache);
3131
}
3232

3333
this.cache = cache;

BitFaster.Caching/Atomic/AtomicFactoryCache.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public AtomicFactoryCache(ICache<K, AtomicFactory<K, V>> cache)
2525
{
2626
if (cache == null)
2727
{
28-
Ex.ThrowArgNull(ExceptionArgument.cache);
28+
Throw.ArgNull(ExceptionArgument.cache);
2929
}
3030

3131
this.cache = cache;

BitFaster.Caching/Atomic/AtomicFactoryScopedAsyncCache.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public AtomicFactoryScopedAsyncCache(ICache<K, ScopedAsyncAtomicFactory<K, V>> c
2727
{
2828
if (cache == null)
2929
{
30-
Ex.ThrowArgNull(ExceptionArgument.cache);
30+
Throw.ArgNull(ExceptionArgument.cache);
3131
}
3232

3333
this.cache = cache;
@@ -107,7 +107,7 @@ private async ValueTask<Lifetime<V>> ScopedGetOrAddAsync<TFactory>(K key, TFacto
107107

108108
if (c++ > ScopedCacheDefaults.MaxRetry)
109109
{
110-
Ex.ThrowScopedRetryFailure();
110+
Throw.ScopedRetryFailure();
111111
}
112112
}
113113
}

BitFaster.Caching/Atomic/AtomicFactoryScopedCache.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public AtomicFactoryScopedCache(ICache<K, ScopedAtomicFactory<K, V>> cache)
2626
{
2727
if (cache == null)
2828
{
29-
Ex.ThrowArgNull(ExceptionArgument.cache);
29+
Throw.ArgNull(ExceptionArgument.cache);
3030
}
3131

3232
this.cache = cache;
@@ -107,7 +107,7 @@ private Lifetime<V> ScopedGetOrAdd<TFactory>(K key, TFactory valueFactory) where
107107

108108
if (c++ > ScopedCacheDefaults.MaxRetry)
109109
{
110-
Ex.ThrowScopedRetryFailure();
110+
Throw.ScopedRetryFailure();
111111
}
112112
}
113113
}

BitFaster.Caching/Buffers/MpmcBoundedBuffer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public MpmcBoundedBuffer(int boundedLength)
2525
{
2626
if (boundedLength < 0)
2727
{
28-
Ex.ThrowArgOutOfRange(nameof(boundedLength));
28+
Throw.ArgOutOfRange(nameof(boundedLength));
2929
}
3030

3131
// must be power of 2 to use & slotsMask instead of %

BitFaster.Caching/Buffers/MpscBoundedBuffer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public MpscBoundedBuffer(int boundedLength)
2525
{
2626
if (boundedLength < 0)
2727
{
28-
Ex.ThrowArgOutOfRange(nameof(boundedLength));
28+
Throw.ArgOutOfRange(nameof(boundedLength));
2929
}
3030

3131
// must be power of 2 to use & slotsMask instead of %

BitFaster.Caching/CacheDebugView.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public CacheDebugView(ICache<K, V> cache)
1313
{
1414
if (cache is null)
1515
{
16-
Ex.ThrowArgNull(ExceptionArgument.cache);
16+
Throw.ArgNull(ExceptionArgument.cache);
1717
}
1818

1919
this.cache = cache;

BitFaster.Caching/Lfu/LfuCapacityPartition.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ private static (int window, int mainProtected, int mainProbation) ComputeQueueCa
122122
{
123123
if (capacity < 3)
124124
{
125-
Ex.ThrowArgOutOfRange(nameof(capacity), "Capacity must be greater than or equal to 3.");
125+
Throw.ArgOutOfRange(nameof(capacity), "Capacity must be greater than or equal to 3.");
126126
}
127127

128128
int window = capacity - (int)(mainPercentage * capacity);

BitFaster.Caching/Lfu/LfuNodeList.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public void Remove(LfuNode<K, V> node)
6666
public void RemoveFirst()
6767
{
6868
#if DEBUG
69-
if (head == null) { Ex.ThrowInvalidOp("List is empty."); }
69+
if (head == null) { Throw.InvalidOp("List is empty."); }
7070
#endif
7171
InternalRemoveNode(head);
7272
}
@@ -125,12 +125,12 @@ internal static void ValidateNewNode(LfuNode<K, V> node)
125125
{
126126
if (node == null)
127127
{
128-
Ex.ThrowArgNull(ExceptionArgument.node);
128+
Throw.ArgNull(ExceptionArgument.node);
129129
}
130130

131131
if (node.list != null)
132132
{
133-
Ex.ThrowInvalidOp("Node is already attached to a list.");
133+
Throw.InvalidOp("Node is already attached to a list.");
134134
}
135135
}
136136

@@ -139,12 +139,12 @@ internal void ValidateNode(LfuNode<K, V> node)
139139
{
140140
if (node == null)
141141
{
142-
Ex.ThrowArgNull(ExceptionArgument.node);
142+
Throw.ArgNull(ExceptionArgument.node);
143143
}
144144

145145
if (node.list != this)
146146
{
147-
Ex.ThrowInvalidOp("Node is already attached to a different list.");
147+
Throw.InvalidOp("Node is already attached to a different list.");
148148
}
149149
}
150150
#endif
@@ -173,7 +173,7 @@ object IEnumerator.Current
173173
{
174174
if (index == 0 || (index == list.Count + 1))
175175
{
176-
Ex.ThrowInvalidOp("Out of bounds");
176+
Throw.InvalidOp("Out of bounds");
177177
}
178178

179179
return Current;

BitFaster.Caching/Lru/CapacityPartitionExtensions.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,17 @@ public static void Validate(this ICapacityPartition capacity)
1616
{
1717
if (capacity.Cold < 1)
1818
{
19-
Ex.ThrowArgOutOfRange(nameof(capacity.Cold));
19+
Throw.ArgOutOfRange(nameof(capacity.Cold));
2020
}
2121

2222
if (capacity.Warm < 1)
2323
{
24-
Ex.ThrowArgOutOfRange(nameof(capacity.Warm));
24+
Throw.ArgOutOfRange(nameof(capacity.Warm));
2525
}
2626

2727
if (capacity.Hot < 1)
2828
{
29-
Ex.ThrowArgOutOfRange(nameof(capacity.Hot));
29+
Throw.ArgOutOfRange(nameof(capacity.Hot));
3030
}
3131
}
3232
}

0 commit comments

Comments
 (0)