Show rendering errors to user

This also delays the response to the HTTP request until the printer has
printed whatever it should.
This commit is contained in:
Joscha 2025-03-03 19:57:32 +01:00
parent 14a0596a25
commit aaa1a916da
9 changed files with 33 additions and 25 deletions

View file

@ -2,7 +2,7 @@ use axum::{Form, extract::State};
use jiff::Zoned;
use serde::{Deserialize, Serialize};
use crate::server::Server;
use crate::server::{Server, somehow};
#[derive(Serialize)]
struct Data {
@ -18,7 +18,7 @@ pub struct FormData {
pub feed: Option<bool>,
}
pub async fn post(server: State<Server>, Form(form): Form<FormData>) {
pub async fn post(server: State<Server>, Form(form): Form<FormData>) -> somehow::Result<()> {
let date = Zoned::now().date();
let data = Data {
@ -31,5 +31,5 @@ pub async fn post(server: State<Server>, Form(form): Form<FormData>) {
.with_json("/data.json", &data)
.with_main_file(include_str!("main.typ"));
server.print_typst(typst).await;
server.print_typst(typst).await
}