From 7dd35230445f7462e78f4c0799d98dbfd47628bf Mon Sep 17 00:00:00 2001 From: T0mstone Date: Thu, 10 Jul 2025 01:27:29 +0200 Subject: [PATCH] Improve error messages Using "codepoint" is more accurate and lines up with what typst's standard library uses --- crates/typst-library/src/math/accent.rs | 2 +- crates/typst-library/src/math/matrix.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/typst-library/src/math/accent.rs b/crates/typst-library/src/math/accent.rs index aebd33475..6c1a34cf6 100644 --- a/crates/typst-library/src/math/accent.rs +++ b/crates/typst-library/src/math/accent.rs @@ -189,6 +189,6 @@ cast! { v: char => Self::new(v), v: Content => match v.to_packed::() { Some(elem) if elem.text.chars().count() == 1 => Self::new(elem.text.chars().next().unwrap()), - _ => bail!("expected a single-character symbol"), + _ => bail!("expected a single-codepoint symbol"), }, } diff --git a/crates/typst-library/src/math/matrix.rs b/crates/typst-library/src/math/matrix.rs index 708160158..d96312094 100644 --- a/crates/typst-library/src/math/matrix.rs +++ b/crates/typst-library/src/math/matrix.rs @@ -274,7 +274,7 @@ cast! { Delimiter, self => self.0.into_value(), _: NoneValue => Self::none(), - v: Symbol => Self::char(v.get().parse::().map_err(|_| "symbol value is longer than one character")?)?, + v: Symbol => Self::char(v.get().parse::().map_err(|_| "expected a single-codepoint symbol")?)?, v: char => Self::char(v)?, }