Skip to content

Commit

Permalink
If used with an incompatible Imageflow ABI, now throws NotSupportedEx…
Browse files Browse the repository at this point in the history
…ception instead of Exception. If JobContext creation fails, an ImageflowException is thrown instead of an OutOfMemoryException
  • Loading branch information
lilith committed Mar 8, 2024
1 parent 953b5de commit aaf2fe8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Imageflow/Bindings/JobContextHandle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit aaf2fe8

Please sign in to comment.