use thiserror::Error;

/// Errors generated by the library.
#[derive(Debug, Error)]
pub enum Error {
    /// Error generated when a preference is not a number.
    #[error("expecting integer preference for '{0}'")]
    PreferenceTypeNumber(String),

    /// Error generated when a preference is not a boolean.
    #[error("expecting boolean preference for '{0}'")]
    PreferenceTypeBool(String),

    /// Error generated when a preference is not a string.
    #[error("expecting string preference for '{0}'")]
    PreferenceTypeString(String),

    /// Error generated when a preference is not a string list.
    #[error("expecting string list preference for '{0}'")]
    PreferenceTypeStringList(String),

    /// Error generated when a preference is not a JSON value.
    #[error("expecting JSON value preference for '{0}'")]
    PreferenceTypeJsonValue(String),

    /// Errors generated by the core library.
    #[error(transparent)]
    Core(#[from] sos_core::Error),
}
