rename fronma::Error newtype

This commit is contained in:
slonkazoid 2024-04-19 16:46:12 +03:00
parent a68fa7cf48
commit 7ab62a0711
Signed by: slonk
SSH key fingerprint: SHA256:tbZfJX4IOvZ0LGWOWu5Ijo8jfMPi78TU7x1VoEeCIjM

View file

@ -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))
}
}