spherenet-monetary-policy-interface 0.3.1

Interface definitions for the SphereNet Monetary Policy program
Documentation
//! Error types

use {
    pinocchio::program_error::ProgramError,
    thiserror::Error,
};

/// Errors that may be returned by the monetary policy program.
#[derive(Error, Clone, Debug, Eq, PartialEq)]
pub enum MonetaryPolicyError {
    /// No pending authority exists
    #[error("No pending authority exists")]
    NoPendingAuthority,
    /// Invalid parameter value provided
    #[error("Invalid parameter value provided")]
    InvalidParameter,
}

impl From<MonetaryPolicyError> for ProgramError {
    fn from(e: MonetaryPolicyError) -> Self {
        ProgramError::Custom(e as u32)
    }
}