SdkException Class
Definition
Namespace: P1.CameraSdk
A simple subclass of the System.Exception class for SDK caused exceptions. Wraps an SDK CameraSdk.ErrorCode for resolving the corresponding error. More…
public class SdkException : Exception
Remarks
A simple subclass of the System.Exception class for SDK caused exceptions. Wraps an SDK CameraSdk.ErrorCode for resolving the corresponding error.
To catch any SDK related errors, you can try catch
on this class. If you need to distinguish between different kind of SDK errors, you can filter on the ErrorCode property.
Here we use the when
clause to filter specific SDK errors:
try { var camera = Camera.OpenUsbCamera(); } catch(SdkException e) when (e.mErrorCode == kErrorCameraNotFound) { Console.WriteLine($"Camera not opened, error: {e}"); }
Here the string interpolation ($"... error: {e}"
) uses the ToString to print the SDK’s error description.
See also: