Commit

Author:

Hash:

Timestamp:

+10 -13 +/-3 browse

Kevin Schoon [me@kevinschoon.com]

0484ee80d4cf1ad01e87cef550ccdabdc654ee4b

Tue, 05 Aug 2025 16:02:36 +0000 (3 months ago)

clean up error page a bit
1diff --git a/ayllu/src/web2/error.rs b/ayllu/src/web2/error.rs
2index 6e30907..57c776d 100644
3--- a/ayllu/src/web2/error.rs
4+++ b/ayllu/src/web2/error.rs
5 @@ -6,7 +6,6 @@ use axum::{
6 };
7 use serde::Serialize;
8
9- use ayllu_api::error::ApiError;
10 use ayllu_git::Error as GitError;
11
12 /// Error maps known error types into errors that can be translated into HTTP
13 @@ -31,18 +30,12 @@ impl IntoResponse for Error {
14 }
15 }
16
17- impl From<ApiError> for Error {
18- fn from(value: ApiError) -> Self {
19- Error::Message(format!("RPC [ayllu]: {value:?}"))
20- }
21- }
22-
23 impl From<GitError> for Error {
24 fn from(value: GitError) -> Self {
25 if value.not_found() {
26- Error::NotFound(format!("GIT: {value:?}"))
27+ Error::NotFound(format!("{value:#?}"))
28 } else {
29- Error::Message(format!("GIT: {value:?}"))
30+ Error::Message(format!("{value:#?}"))
31 }
32 }
33 }
34 @@ -51,13 +44,13 @@ impl From<IoError> for Error {
35 fn from(value: IoError) -> Self {
36 match value.kind() {
37 std::io::ErrorKind::NotFound => Error::NotFound(format!("IO: {value}")),
38- _ => Error::Message(format!("IO: {value:?}")),
39+ _ => Error::Message(format!("IO: {value:#?}")),
40 }
41 }
42 }
43
44 impl From<askama::Error> for Error {
45 fn from(value: askama::Error) -> Self {
46- Error::Message(format!("Template Error: {value:?}"))
47+ Error::Message(format!("Template Error: {value:#?}"))
48 }
49 }
50 diff --git a/ayllu/src/web2/middleware/error.rs b/ayllu/src/web2/middleware/error.rs
51index 39f3c0f..e44af52 100644
52--- a/ayllu/src/web2/middleware/error.rs
53+++ b/ayllu/src/web2/middleware/error.rs
54 @@ -8,8 +8,8 @@ use axum::{
55 response::{Html, IntoResponse, Response},
56 };
57
58- use crate::web2::error::Error;
59 use crate::web2::extractors::config::ConfigReader;
60+ use crate::web2::{error::Error, template::DEFAULT_LOGO};
61 use crate::{config::Config, web2::template::Base};
62
63 pub type State = Arc<Config>;
64 @@ -49,6 +49,8 @@ pub async fn middleware(
65 NotFoundPage {
66 base: Base {
67 title: String::from("Resource Not Found"),
68+ nav_elements: crate::web2::navigation::global("", false),
69+ logo: DEFAULT_LOGO.to_string(),
70 ..Default::default()
71 },
72 status_code: "404",
73 @@ -64,6 +66,8 @@ pub async fn middleware(
74 ErrorPage {
75 base: Base {
76 title: String::from("Internal Server Error"),
77+ nav_elements: crate::web2::navigation::global("", false),
78+ logo: DEFAULT_LOGO.to_string(),
79 ..Default::default()
80 },
81 status_code: status_code.as_str(),
82 diff --git a/ayllu/templates/5xx.html b/ayllu/templates/5xx.html
83index e0870d3..81d5e01 100644
84--- a/ayllu/templates/5xx.html
85+++ b/ayllu/templates/5xx.html
86 @@ -1,6 +1,6 @@
87 {% extends "base.html" %}
88 {% block content %}
89- <section class="strech">
90+ <section>
91 <h1>Internal Service Error ({{ status_code }})</h1>
92 <p>Something has gone wrong processing your request, please be patient.</p>
93 <h4>Error Message:</h4>