spl_name_service/
error.rs

1use {
2    num_derive::FromPrimitive,
3    solana_program::{decode_error::DecodeError, program_error::ProgramError},
4    thiserror::Error,
5};
6
7#[derive(Clone, Debug, Eq, Error, FromPrimitive, PartialEq)]
8pub enum NameServiceError {
9    #[error("Out of space")]
10    OutOfSpace,
11}
12
13pub type NameServiceResult = Result<(), NameServiceError>;
14
15impl From<NameServiceError> for ProgramError {
16    fn from(e: NameServiceError) -> Self {
17        ProgramError::Custom(e as u32)
18    }
19}
20
21impl<T> DecodeError<T> for NameServiceError {
22    fn type_of() -> &'static str {
23        "NameServiceError"
24    }
25}