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
|
// fronma is too lazy to implement std::error::Error for their own types
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
#[repr(transparent)]
|
#[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 {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
f.write_str("failed to parse front matter: ")?;
|
f.write_str("failed to parse front matter: ")?;
|
||||||
match &self.0 {
|
match &self.0 {
|
||||||
|
@ -29,14 +29,14 @@ pub enum PostError {
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
AskamaError(#[from] askama::Error),
|
AskamaError(#[from] askama::Error),
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
ParseError(#[from] FronmaBalls),
|
ParseError(#[from] FronmaError),
|
||||||
#[error("post {0:?} not found")]
|
#[error("post {0:?} not found")]
|
||||||
NotFound(String),
|
NotFound(String),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<fronma::error::Error> for PostError {
|
impl From<fronma::error::Error> for PostError {
|
||||||
fn from(value: fronma::error::Error) -> Self {
|
fn from(value: fronma::error::Error) -> Self {
|
||||||
Self::ParseError(FronmaBalls(value))
|
Self::ParseError(FronmaError(value))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue