Skip to main content

waterkit_core/
error.rs

1//! Shared error variants for cross-cutting failures.
2//!
3//! Each capability crate defines its own `Error` enum, but several variants
4//! are universal: "this platform does not support the operation",
5//! "permission was denied", "platform-specific failure with a message".
6//! Crates may embed [`CoreError`] inside their own enum or simply mirror
7//! its variants — using the same shape makes downstream `match` patterns
8//! consistent.
9
10use thiserror::Error;
11
12/// Cross-cutting error variants shared by waterkit capability crates.
13#[derive(Debug, Clone, Error)]
14#[non_exhaustive]
15pub enum CoreError {
16    /// Operation is not supported on the current platform / OS / device.
17    #[error("operation not supported on this platform")]
18    Unsupported,
19
20    /// User has not granted the required permission, or the OS denies it
21    /// at policy level (e.g. parental controls, MDM).
22    #[error("permission denied")]
23    PermissionDenied,
24
25    /// Platform-level failure with a message from the underlying API.
26    #[error("platform error: {0}")]
27    Platform(String),
28}