aboutsummaryrefslogtreecommitdiff
path: root/wrappers/dotnet/VNLib.Utils.Cryptography.Noscrypt/src/NCUtil.cs
diff options
context:
space:
mode:
authorLibravatar vnugent <public@vaughnnugent.com>2024-08-17 21:33:23 -0400
committerLibravatar vnugent <public@vaughnnugent.com>2024-08-17 21:33:23 -0400
commit2162178cb7e209e9f060748842e1c4782a2ab852 (patch)
tree830e67e28e2a6c366b1baaba4f8805489b4e0ff1 /wrappers/dotnet/VNLib.Utils.Cryptography.Noscrypt/src/NCUtil.cs
parent0925f5c786badb715d564e991d2306632c2aecad (diff)
refactor: cipher utils update and simplify
Diffstat (limited to 'wrappers/dotnet/VNLib.Utils.Cryptography.Noscrypt/src/NCUtil.cs')
-rw-r--r--wrappers/dotnet/VNLib.Utils.Cryptography.Noscrypt/src/NCUtil.cs17
1 files changed, 8 insertions, 9 deletions
diff --git a/wrappers/dotnet/VNLib.Utils.Cryptography.Noscrypt/src/NCUtil.cs b/wrappers/dotnet/VNLib.Utils.Cryptography.Noscrypt/src/NCUtil.cs
index 49c66c1..307bbc1 100644
--- a/wrappers/dotnet/VNLib.Utils.Cryptography.Noscrypt/src/NCUtil.cs
+++ b/wrappers/dotnet/VNLib.Utils.Cryptography.Noscrypt/src/NCUtil.cs
@@ -127,35 +127,34 @@ namespace VNLib.Utils.Cryptography.Noscrypt
// Error code are only 8 bits, if an argument error occured, the
// argument number will be in the next upper 8 bits
- byte errorCode = (byte)(asPositive & 0xFF);
+ NCErrorCodes errorCode = (NCErrorCodes)(asPositive & 0xFF);
byte argNumber = (byte)((asPositive >> 8) & 0xFF);
switch (errorCode)
{
- case E_NULL_PTR:
+ case NCErrorCodes.E_NULL_PTR:
RaiseNullArgExceptionForArgumentNumber<T>(argNumber);
break;
- case E_INVALID_ARG:
+ case NCErrorCodes.E_INVALID_ARG:
RaiseArgExceptionForArgumentNumber<T>(argNumber);
break;
- case E_ARGUMENT_OUT_OF_RANGE:
+ case NCErrorCodes.E_ARGUMENT_OUT_OF_RANGE:
RaiseOORExceptionForArgumentNumber<T>(argNumber);
break;
- case E_INVALID_CTX:
+ case NCErrorCodes.E_INVALID_CTX:
throw new InvalidOperationException("The library context object is null or invalid");
- case E_OPERATION_FAILED:
+ case NCErrorCodes.E_OPERATION_FAILED:
RaiseOperationFailedException(raiseOnFailure);
break;
- case E_VERSION_NOT_SUPPORTED:
+ case NCErrorCodes.E_VERSION_NOT_SUPPORTED:
throw new NotSupportedException("The requested version is not supported");
default:
if(raiseOnFailure)
{
- throw new InvalidOperationException($"The operation failed for an unknown reason, code: {errorCode:x}");
+ throw new InvalidOperationException($"The operation failed with error, code: {errorCode} for arugment {argNumber:x}");
}
break;
-
}
}