-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
248 additions
and
221 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
use std::{ | ||
error::Error, | ||
fmt::{self, Display, Formatter}, | ||
}; | ||
|
||
#[derive(Debug)] | ||
pub enum OdsError { | ||
ExpectedSuperClass(&'static str), | ||
InvalidTrait, | ||
UnexpectedSuperClass(&'static str), | ||
} | ||
|
||
impl Display for OdsError { | ||
fn fmt(&self, formatter: &mut Formatter) -> fmt::Result { | ||
match self { | ||
Self::ExpectedSuperClass(class) => { | ||
write!(formatter, "record should be a sub-class of {class}",) | ||
} | ||
Self::InvalidTrait => write!(formatter, "record is not a supported trait"), | ||
Self::UnexpectedSuperClass(class) => { | ||
write!(formatter, "record should not be a sub-class of {class}",) | ||
} | ||
} | ||
} | ||
} | ||
|
||
impl Error for OdsError {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.