Expand description
Error types for ScreenCaptureKit operations
This module provides error types and result aliases for handling failures in screen capture operations.
§Main Types
SCError- The main error type for allScreenCaptureKitoperationsSCResult<T>- Type alias forResult<T, SCError>SCStreamErrorCode- Specific error codes fromScreenCaptureKitframework
§Error Handling Example
use screencapturekit::error::{SCError, SCResult};
use screencapturekit::prelude::*;
fn capture_screen() -> SCResult<()> {
let content = SCShareableContent::get()?;
if content.displays().is_empty() {
return Err(SCError::internal_error("No displays available"));
}
// ... capture logic ...
Ok(())
}
fn main() {
match capture_screen() {
Ok(()) => println!("Capture successful"),
Err(SCError::NoShareableContent(msg)) => {
eprintln!("Permission denied: {}", msg);
}
Err(e) => eprintln!("Error: {}", e),
}
}Re-exports§
pub use crate::utils::error::SCError;pub use crate::utils::error::SCResult;pub use crate::utils::error::SCStreamErrorCode;pub use crate::utils::error::SC_STREAM_ERROR_DOMAIN;