microsandbox_types/error.rs
1//! Error types for shared microsandbox contracts.
2
3//--------------------------------------------------------------------------------------------------
4// Types
5//--------------------------------------------------------------------------------------------------
6
7/// The result type for shared microsandbox contract operations.
8pub type TypesResult<T> = Result<T, TypesError>;
9
10/// Errors returned by shared microsandbox contract helpers.
11#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
12pub enum TypesError {
13 /// A supplied configuration value is invalid.
14 #[error("invalid config: {0}")]
15 InvalidConfig(String),
16}
17
18//--------------------------------------------------------------------------------------------------
19// Methods
20//--------------------------------------------------------------------------------------------------
21
22impl TypesError {
23 pub(crate) fn invalid_config(message: impl Into<String>) -> Self {
24 Self::InvalidConfig(message.into())
25 }
26}