Skip to main content

ndi_sdk/
error.rs

1use std::str::Utf8Error;
2
3#[derive(thiserror::Error, Debug)]
4pub enum NDIError {
5    #[error("Failed to load NDI Library: {0}")]
6    LoadingError(#[from] libloading::Error),
7
8    #[error("NDIlib_v5_load() returned NULL - no NDIlib_v5 returned!")]
9    LoadV5Failed,
10
11    #[error("NDIlib_v5->initialize() failed, is the CPU supported?")]
12    InitializeFailed,
13
14    #[error("NDIlib_v5 struct is missing symbol: {0}")]
15    MissingSymbolV5(&'static str),
16
17    #[error("NDIlib_v5 function returned a NULL pointer unexpectedly: {0}")]
18    UnexpectedNullPointer(&'static str),
19
20    #[error("Failed to parse C String as valid UTF-8: {0}")]
21    Utf8Error(#[from] Utf8Error),
22
23    #[error("String contains NULL bytes, cannot convert to C String")]
24    InvalidCString,
25}
26
27pub type NDIResult<T> = std::result::Result<T, NDIError>;