Skip to main content

potree_auth/render/http/
error.rs

1use super::super::application::error::RenderingServiceError;
2use crate::common::utils::http::render_error::RenderError;
3
4impl From<RenderingServiceError> for RenderError {
5    fn from(value: RenderingServiceError) -> Self {
6        match value {
7            RenderingServiceError::ProjectNotFound { id } => Self::ResourceNotFound {
8                resource_name: format!("project: {id}"),
9            },
10            RenderingServiceError::NotAuthorized {
11                user,
12                action,
13                resource_identifier,
14                resource_type,
15            } => Self::NotAuthorized {
16                user,
17                action,
18                resource_identifier,
19                resource_type,
20            },
21            RenderingServiceError::NotAuthenticated => Self::NotAuthenticated,
22            RenderingServiceError::ServerConfiguration { message } => {
23                Self::ServerConfiguration { message }
24            }
25            RenderingServiceError::Infrastucture { message } => Self::Infrastucture { message },
26        }
27    }
28}
29
30impl From<askama::Error> for RenderError {
31    fn from(value: askama::Error) -> Self {
32        Self::ServerError {
33            message: format!("error rendering template: {value}"),
34        }
35    }
36}