mirror of
https://github.com/typst/typst
synced 2025-07-27 14:27:56 +08:00
Improve error messages
Using "codepoint" is more accurate and lines up with what typst's standard library uses
This commit is contained in:
parent
0160bf1547
commit
7dd3523044
@ -189,6 +189,6 @@ cast! {
|
||||
v: char => Self::new(v),
|
||||
v: Content => match v.to_packed::<SymbolElem>() {
|
||||
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"),
|
||||
},
|
||||
}
|
||||
|
@ -274,7 +274,7 @@ cast! {
|
||||
Delimiter,
|
||||
self => self.0.into_value(),
|
||||
_: NoneValue => Self::none(),
|
||||
v: Symbol => Self::char(v.get().parse::<char>().map_err(|_| "symbol value is longer than one character")?)?,
|
||||
v: Symbol => Self::char(v.get().parse::<char>().map_err(|_| "expected a single-codepoint symbol")?)?,
|
||||
v: char => Self::char(v)?,
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user