.. _doxcsid-class_p1_1_1_camera_sdk_1_1_sdk_exception: SdkException Class ~~~~~~~~~~~~~~~~~~ Definition ^^^^^^^^^^ *Namespace:* ``P1.CameraSdk`` A simple subclass of the System.Exception class for SDK caused exceptions. Wraps an SDK :ref:`CameraSdk.ErrorCode ` for resolving the corresponding error. :ref:`More...` .. ref-code-block:: csharp :class: doxyrest-overview-code-block public class SdkException : Exception .. _csdetails-class_p1_1_1_camera_sdk_1_1_sdk_exception: Remarks ^^^^^^^ A simple subclass of the System.Exception class for SDK caused exceptions. Wraps an SDK :ref:`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 :ref:`ErrorCode ` property. Here we use the ``when`` clause to filter specific SDK errors: .. ref-code-block:: cpp 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 :ref:`ToString ` to print the SDK's error description. .. rubric:: See also: :ref:`CameraSdk.ErrorCode ` Constructors ^^^^^^^^^^^^ .. toctree:: :hidden: SdkException .. list-table:: :widths: 30 70 * - :ref:`SdkException(ErrorCode errorCode) ` - Create an SDK error from an ErrorCode, with an automatically loaded description Properties ^^^^^^^^^^ .. toctree:: :hidden: ErrorCode ErrorMessage .. list-table:: :widths: 30 70 * - :ref:`ErrorCode ` - The error code provided by the underlying SDK * - :ref:`ErrorMessage ` - Optional error description from the SDK Methods ^^^^^^^ .. toctree:: :hidden: ToString .. list-table:: :widths: 33 67 * - :ref:`ToString() ` - A string representation of the SDK exception