Switched Universe to Global.
Some checks failed
MoreThanText/morethantext/pipeline/head There was a failure building this commit
Some checks failed
MoreThanText/morethantext/pipeline/head There was a failure building this commit
This commit is contained in:
22
src/error.rs
22
src/error.rs
@ -1,4 +1,4 @@
|
||||
use crate::data::{database::DBError, id::IDError, table::TBLError, UniError};
|
||||
use crate::data::{database::DBError, id::IDError, table::TBLError, GblError};
|
||||
use std::{error::Error, fmt};
|
||||
|
||||
#[derive(Debug)]
|
||||
@ -6,7 +6,7 @@ pub enum ErrorType {
|
||||
DBErr(DBError),
|
||||
IDErr(IDError),
|
||||
TBLErr(TBLError),
|
||||
UniErr(UniError),
|
||||
GblErr(GblError),
|
||||
}
|
||||
|
||||
impl From<DBError> for ErrorType {
|
||||
@ -27,9 +27,9 @@ impl From<TBLError> for ErrorType {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<UniError> for ErrorType {
|
||||
fn from(value: UniError) -> Self {
|
||||
ErrorType::UniErr(value)
|
||||
impl From<GblError> for ErrorType {
|
||||
fn from(value: GblError) -> Self {
|
||||
ErrorType::GblErr(value)
|
||||
}
|
||||
}
|
||||
|
||||
@ -39,7 +39,7 @@ impl fmt::Display for ErrorType {
|
||||
ErrorType::DBErr(data) => write!(f, "database: {}", data),
|
||||
ErrorType::IDErr(data) => write!(f, "id: {}", data),
|
||||
ErrorType::TBLErr(data) => write!(f, "table: {}", data),
|
||||
ErrorType::UniErr(data) => write!(f, "global: {}", data),
|
||||
ErrorType::GblErr(data) => write!(f, "global: {}", data),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -71,7 +71,7 @@ mod errortypes {
|
||||
|
||||
#[test]
|
||||
fn universal_error() {
|
||||
let err = UniError::DuplicateDB("bad".to_string());
|
||||
let err = GblError::DuplicateDB("bad".to_string());
|
||||
let result = ErrorType::from(err.clone());
|
||||
assert_eq!(result.to_string(), format!("global: {}", err));
|
||||
}
|
||||
@ -124,8 +124,8 @@ impl From<TBLError> for MTTError {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<UniError> for MTTError {
|
||||
fn from(value: UniError) -> Self {
|
||||
impl From<GblError> for MTTError {
|
||||
fn from(value: GblError) -> Self {
|
||||
Self { err: value.into() }
|
||||
}
|
||||
}
|
||||
@ -166,8 +166,8 @@ mod errors {
|
||||
|
||||
#[test]
|
||||
fn from_global_error() {
|
||||
let error = UniError::DuplicateDB(rand_str());
|
||||
let error = GblError::DuplicateDB(rand_str());
|
||||
let err = MTTError::from(error.clone());
|
||||
assert_eq!(err.to_string(), ErrorType::UniErr(error).to_string());
|
||||
assert_eq!(err.to_string(), ErrorType::GblErr(error).to_string());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user