Skip to content

Commit 1c118b8

Browse files
committed
Update throw helpers
1 parent 0de43ad commit 1c118b8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

QRCoder/QRCodeGenerator.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,7 +1003,7 @@ private static byte[] BinaryStringToBitBlockByteList(BitArray bitString, int off
10031003
{
10041004
const int blockSize = 8;
10051005
if (count % blockSize != 0)
1006-
ThrowArgumentException(nameof(count));
1006+
ThrowCountMustBeMultipleOf8Exception();
10071007
var numberOfBlocks = (int)((uint)count / blockSize);
10081008
var blocklist = new byte[numberOfBlocks];
10091009

@@ -1024,7 +1024,7 @@ private static byte[] BinaryStringToBitBlockByteList(BitArray bitString, int off
10241024

10251025
return blocklist;
10261026

1027-
void ThrowArgumentException(string paramName) => throw new ArgumentOutOfRangeException(paramName, "Count must be a multiple of 8.");
1027+
void ThrowCountMustBeMultipleOf8Exception() => throw new ArgumentOutOfRangeException(nameof(count), "Count must be a multiple of 8.");
10281028
}
10291029

10301030
private static int BinToDec(BitArray bitArray, int offset, int count)
@@ -1352,10 +1352,10 @@ private static int GetIntValFromAlphaExp(int exp)
13521352
private static int GetAlphaExpFromIntVal(int intVal)
13531353
{
13541354
if (intVal == 0)
1355-
ThrowArgumentOutOfRangeException(nameof(intVal));
1355+
ThrowIntValOutOfRangeException();
13561356
return galoisFieldByIntegerValue[intVal];
13571357

1358-
void ThrowArgumentOutOfRangeException(string paramName) => throw new ArgumentOutOfRangeException(paramName);
1358+
void ThrowIntValOutOfRangeException() => throw new ArgumentOutOfRangeException(nameof(intVal));
13591359
}
13601360

13611361
private static int ShrinkAlphaExp(int alphaExp)

0 commit comments

Comments
 (0)