Skip to main content

blvm_sdk/governance/
error.rs

1//! # Governance Error Types
2//!
3//! Error handling for governance operations.
4
5use thiserror::Error;
6
7/// Result type for governance operations
8pub type GovernanceResult<T> = Result<T, GovernanceError>;
9
10/// Errors that can occur during governance operations
11#[derive(Error, Debug)]
12pub enum GovernanceError {
13    /// Invalid key format or key generation failure
14    #[error("Invalid key: {0}")]
15    InvalidKey(String),
16
17    /// Signature verification failed
18    #[error("Signature verification failed: {0}")]
19    SignatureVerification(String),
20
21    /// Invalid multisig configuration
22    #[error("Invalid multisig configuration: {0}")]
23    InvalidMultisig(String),
24
25    /// Message format error
26    #[error("Message format error: {0}")]
27    MessageFormat(String),
28
29    /// Cryptographic operation failed
30    #[error("Cryptographic operation failed: {0}")]
31    Cryptographic(String),
32
33    /// Serialization/deserialization error
34    #[error("Serialization error: {0}")]
35    Serialization(String),
36
37    /// Invalid threshold configuration
38    #[error("Invalid threshold: {threshold} of {total}")]
39    InvalidThreshold { threshold: usize, total: usize },
40
41    /// Insufficient signatures for multisig
42    #[error("Insufficient signatures: got {got}, need {need}")]
43    InsufficientSignatures { got: usize, need: usize },
44
45    /// Invalid signature format
46    #[error("Invalid signature format: {0}")]
47    InvalidSignatureFormat(String),
48
49    /// Invalid input data
50    #[error("Invalid input: {0}")]
51    InvalidInput(String),
52
53    /// Feature not yet implemented
54    #[error("Not implemented: {0}")]
55    NotImplemented(String),
56}