screencapturekit/error.rs
1//! Error types for `ScreenCaptureKit` operations
2//!
3//! This module provides error types and result aliases for handling
4//! failures in screen capture operations.
5//!
6//! ## Main Types
7//!
8//! - [`SCError`] - The main error type for all `ScreenCaptureKit` operations
9//! - [`SCResult<T>`] - Type alias for `Result<T, SCError>`
10//! - [`SCStreamErrorCode`] - Specific error codes from `ScreenCaptureKit` framework
11//!
12//! ## Error Handling Example
13//!
14//! ```rust,no_run
15//! use screencapturekit::error::{SCError, SCResult};
16//! use screencapturekit::prelude::*;
17//!
18//! fn capture_screen() -> SCResult<()> {
19//! let content = SCShareableContent::get()?;
20//!
21//! if content.displays().is_empty() {
22//! return Err(SCError::internal_error("No displays available"));
23//! }
24//!
25//! // ... capture logic ...
26//! Ok(())
27//! }
28//!
29//! fn main() {
30//! match capture_screen() {
31//! Ok(()) => println!("Capture successful"),
32//! Err(SCError::NoShareableContent(msg)) => {
33//! eprintln!("Permission denied: {}", msg);
34//! }
35//! Err(e) => eprintln!("Error: {}", e),
36//! }
37//! }
38//! ```
39
40pub use crate::utils::error::{SCError, SCResult, SCStreamErrorCode, SC_STREAM_ERROR_DOMAIN};