use thiserror::Error;
#[cfg(feature = "std")]
use std::io::Error as IoError;
#[cfg(feature = "std")]
use std::string::FromUtf8Error;
#[cfg(not(feature = "std"))]
use alloc::string::FromUtf8Error;
#[derive(Debug, Error)]
pub enum CoreError {
#[error("Unable to parse string as `{1}`; value: {0:?}")]
InvalidValueFromStr(String, &'static str),
#[error("Value `{0}` is not valid for type `{1}`")]
InvalidValue(String, &'static str),
#[error("Unable to convert from UTF-8 to string; error: {0}")]
FromUtf(#[from] FromUtf8Error),
#[cfg(feature = "std")]
#[error("An I/O error occurred; error: {0}")]
Io(#[from] IoError),
}
pub type Result<T> = std::result::Result<T, CoreError>;