summaryrefslogtreecommitdiff
path: root/crates/typst-library/src/text
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2023-09-11 12:04:37 +0200
committerLaurenz <laurmaedje@gmail.com>2023-09-11 12:04:37 +0200
commit921b40cf9cb75c6412e2421130671b08dcf1ee13 (patch)
tree817735ec1d2dabcbb0cd3d38f73f5e2772eb5300 /crates/typst-library/src/text
parent6483d3035bab4df2d644acb738974413977aaa37 (diff)
Forward third-party errors
Better to know something even if it isn't always formatted in the prettiest way
Diffstat (limited to 'crates/typst-library/src/text')
-rw-r--r--crates/typst-library/src/text/raw.rs9
1 files changed, 4 insertions, 5 deletions
diff --git a/crates/typst-library/src/text/raw.rs b/crates/typst-library/src/text/raw.rs
index a9d40414..a5699afd 100644
--- a/crates/typst-library/src/text/raw.rs
+++ b/crates/typst-library/src/text/raw.rs
@@ -485,10 +485,9 @@ fn load_syntaxes(paths: &SyntaxPaths, bytes: &[Bytes]) -> StrResult<Arc<SyntaxSe
// We might have multiple sublime-syntax/yaml files
for (path, bytes) in paths.0.iter().zip(bytes.iter()) {
let src = std::str::from_utf8(bytes).map_err(FileError::from)?;
- out.add(
- SyntaxDefinition::load_from_str(src, false, None)
- .map_err(|e| eco_format!("failed to parse syntax file `{path}`: {e}"))?,
- );
+ out.add(SyntaxDefinition::load_from_str(src, false, None).map_err(|err| {
+ eco_format!("failed to parse syntax file `{path}` ({err})")
+ })?);
}
Ok(Arc::new(out.build()))
@@ -528,7 +527,7 @@ fn load_theme(path: EcoString, bytes: Bytes) -> StrResult<Arc<synt::Theme>> {
synt::ThemeSet::load_from_reader(&mut cursor)
.map(Arc::new)
- .map_err(|e| eco_format!("failed to parse theme file `{path}`: {e}"))
+ .map_err(|err| eco_format!("failed to parse theme file `{path}` ({err})"))
}
/// Function to parse the theme argument.