#[cfg(feature = "ser")]
use ron::error::{Error as RonErr, SpannedError};
use std::{io::Error as IoErr, result::Result as StdRes};
use thiserror::Error;
pub type Result<T> = StdRes<T, MistError>;
#[derive(Error, Debug)]
pub enum MistError {
#[cfg(feature = "ser")]
#[error("could not serialize: {0}")]
Ser(#[from] RonErr),
#[cfg(feature = "ser")]
#[error("could not deserialize file: {0}")]
De(#[from] SpannedError),
#[error("i/o error: {0}")]
Io(#[from] IoErr),
#[error("{0}")]
Str(String),
}
impl From<&str> for MistError {
fn from(e: &str) -> Self {
Self::Str(e.into())
}
}
impl From<String> for MistError {
fn from(e: String) -> Self {
Self::Str(e)
}
}