From c74de46f8b760c7c6b7b16ee39f7470037693f90 Mon Sep 17 00:00:00 2001 From: Dandaedre Date: Mon, 20 Jul 2026 20:03:35 +0200 Subject: [PATCH] Adds an error recap --- Cargo.toml | 2 +- crates/make/src/makepdf.rs | 7 ++++++- crates/make/src/makepdf_structs.rs | 18 +++++++++++++++--- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index afde8de..7798d1a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,7 @@ resolver = "3" # edition = "2024" # license = "MIT OR Apache-2.0" [workspace.package] -version = "0.3.9" +version = "0.3.10" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/crates/make/src/makepdf.rs b/crates/make/src/makepdf.rs index 38096e1..af25c72 100644 --- a/crates/make/src/makepdf.rs +++ b/crates/make/src/makepdf.rs @@ -268,6 +268,10 @@ fn checkline( return Ok(()); } + if final_line.vlvl() >= VerboseLevel::Error { + let v = final_line.clone(); + let _ = status.first_error.set(v); + } match &final_line.vlvl() { VerboseLevel::None => (), VerboseLevel::Misc => pb.println(format!( @@ -327,7 +331,7 @@ fn checkline( )) } VerboseLevel::Uncatchable => { - // status.errors += 1; + status.errors += 1; pb.println(format!( "{} {}", *TXT_UKNW, @@ -335,5 +339,6 @@ fn checkline( )) } } + Ok(()) } diff --git a/crates/make/src/makepdf_structs.rs b/crates/make/src/makepdf_structs.rs index 3bad49a..70d1aaf 100644 --- a/crates/make/src/makepdf_structs.rs +++ b/crates/make/src/makepdf_structs.rs @@ -7,6 +7,7 @@ use config::make::VerboseLevel; use logos::Logos; use serde::{Deserialize, Serialize}; use std::{ + cell::OnceCell, io::{Read, Write}, sync::LazyLock, time::{Duration, Instant}, @@ -141,7 +142,7 @@ impl BuildInfo { /// The line encountered // #[allow(unused)] -#[derive(Debug, Logos, PartialEq)] +#[derive(Debug, Logos, PartialEq, Clone)] #[logos(skip r"[) ]+")] pub(super) enum LineType { /// The tex building mode : entering extended mode @@ -407,8 +408,8 @@ pub(super) struct Status { pub(super) warnings: usize, /// Only makes sense with non-interactie builds pub(super) errors: usize, - // /// List of all recoverable - // pub(super) v_errors: Vec, + /// List of all recoverable + pub(super) first_error: OnceCell, } impl Status { @@ -418,6 +419,7 @@ impl Status { info: 0, warnings: 0, errors: 0, + first_error: OnceCell::new(), } } @@ -429,6 +431,16 @@ impl Status { file_info: BuilderParseResult, ) { let col_bld = COL_INFO.clone().bold(); + if self.errors > 3 { + println!( + "{} {}", + col_bld.apply_to("[RCAP]"), + COL_NORMAL.apply_to(format!( + "The first error encountered was: {:?}", + self.first_error.get() + )) + ); + } println!(); println!( "{} {}",