From aaf2fe813dfd5052974ed29284e099143a8cbac4 Mon Sep 17 00:00:00 2001 From: Lilith River Date: Thu, 7 Mar 2024 23:11:19 -0700 Subject: [PATCH] If used with an incompatible Imageflow ABI, now throws NotSupportedException instead of Exception. If JobContext creation fails, an ImageflowException is thrown instead of an OutOfMemoryException --- src/Imageflow/Bindings/JobContextHandle.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Imageflow/Bindings/JobContextHandle.cs b/src/Imageflow/Bindings/JobContextHandle.cs index 0d29321..ab09291 100644 --- a/src/Imageflow/Bindings/JobContextHandle.cs +++ b/src/Imageflow/Bindings/JobContextHandle.cs @@ -25,11 +25,11 @@ public JobContextHandle() if (NativeMethods.imageflow_abi_compatible(NativeMethods.ABI_MAJOR, NativeMethods.ABI_MINOR)) { - throw new OutOfMemoryException("Failed to create Imageflow JobContext"); + throw new ImageflowException("Failed to create Imageflow JobContext (yet other calls succeed); this may indicate an out-of-memory condition."); } var major = NativeMethods.imageflow_abi_version_major(); var minor = NativeMethods.imageflow_abi_version_minor(); - throw new Exception( + throw new NotSupportedException( $".NET Imageflow bindings only support ABI {NativeMethods.ABI_MAJOR}.{NativeMethods.ABI_MINOR}. libimageflow ABI {major}.{minor} is loaded."); } SetHandle(ptr);