1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
use std::fmt;
use std::error::Error;
use crate::schema::Schema;

pub type Result<T = Schema> = std::result::Result<T, MakeSchemaError>;

#[derive(Debug, Clone)]
pub struct MakeSchemaError {
    msg: &'static str,
    schema: Schema
}

impl MakeSchemaError {
    pub fn new(msg: &'static str, schema: Schema) -> MakeSchemaError {
        MakeSchemaError { msg, schema }
    }
}

impl fmt::Display for MakeSchemaError {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        write!(f, "{} Schema: {:?}", self.msg, self.schema)
    }
}

impl Error for MakeSchemaError {
}