forked from slonk/bingus-blog
rename fronma::Error newtype
This commit is contained in:
parent
a68fa7cf48
commit
7ab62a0711
1 changed files with 5 additions and 5 deletions
10
src/error.rs
10
src/error.rs
|
@ -6,11 +6,11 @@ use thiserror::Error;
|
|||
// fronma is too lazy to implement std::error::Error for their own types
|
||||
#[derive(Debug)]
|
||||
#[repr(transparent)]
|
||||
pub struct FronmaBalls(fronma::error::Error);
|
||||
pub struct FronmaError(fronma::error::Error);
|
||||
|
||||
impl std::error::Error for FronmaBalls {}
|
||||
impl std::error::Error for FronmaError {}
|
||||
|
||||
impl Display for FronmaBalls {
|
||||
impl Display for FronmaError {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.write_str("failed to parse front matter: ")?;
|
||||
match &self.0 {
|
||||
|
@ -29,14 +29,14 @@ pub enum PostError {
|
|||
#[error(transparent)]
|
||||
AskamaError(#[from] askama::Error),
|
||||
#[error(transparent)]
|
||||
ParseError(#[from] FronmaBalls),
|
||||
ParseError(#[from] FronmaError),
|
||||
#[error("post {0:?} not found")]
|
||||
NotFound(String),
|
||||
}
|
||||
|
||||
impl From<fronma::error::Error> for PostError {
|
||||
fn from(value: fronma::error::Error) -> Self {
|
||||
Self::ParseError(FronmaBalls(value))
|
||||
Self::ParseError(FronmaError(value))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue