summaryrefslogtreecommitdiff
path: root/src/library/math
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-09-20 19:49:47 +0200
committerLaurenz <laurmaedje@gmail.com>2022-09-20 19:49:47 +0200
commit3760748fddd3b793c79c370398a9d4a3fc5afc04 (patch)
treeb1a615e510aa231cfe9757a9c0a35a375e32e3ba /src/library/math
parent757a701c1aa2a6fb80033c7e75666661818da6f9 (diff)
Refactor error handling
Diffstat (limited to 'src/library/math')
-rw-r--r--src/library/math/mod.rs6
-rw-r--r--src/library/math/rex.rs4
2 files changed, 5 insertions, 5 deletions
diff --git a/src/library/math/mod.rs b/src/library/math/mod.rs
index ed98ab1c..d71f6976 100644
--- a/src/library/math/mod.rs
+++ b/src/library/math/mod.rs
@@ -28,7 +28,7 @@ impl MathNode {
#[property(resolve, shorthand(around))]
pub const BELOW: Option<BlockSpacing> = Some(Ratio::one().into());
- fn construct(_: &mut Vm, args: &mut Args) -> TypResult<Content> {
+ fn construct(_: &mut Vm, args: &mut Args) -> SourceResult<Content> {
Ok(Content::show(Self {
formula: args.expect("formula")?,
display: args.named("display")?.unwrap_or(false),
@@ -48,7 +48,7 @@ impl Show for MathNode {
}
}
- fn realize(&self, _: &dyn World, styles: StyleChain) -> TypResult<Content> {
+ fn realize(&self, _: &dyn World, styles: StyleChain) -> SourceResult<Content> {
let node = self::rex::RexNode {
tex: self.formula.clone(),
display: self.display,
@@ -67,7 +67,7 @@ impl Show for MathNode {
_: &dyn World,
styles: StyleChain,
mut realized: Content,
- ) -> TypResult<Content> {
+ ) -> SourceResult<Content> {
let mut map = StyleMap::new();
map.set_family(styles.get(Self::FAMILY).clone(), styles);
diff --git a/src/library/math/rex.rs b/src/library/math/rex.rs
index 7bfdeb7a..76ba5177 100644
--- a/src/library/math/rex.rs
+++ b/src/library/math/rex.rs
@@ -25,13 +25,13 @@ impl Layout for RexNode {
world: &dyn World,
_: &Regions,
styles: StyleChain,
- ) -> TypResult<Vec<Frame>> {
+ ) -> SourceResult<Vec<Frame>> {
// Load the font.
let span = self.tex.span;
let font = world
.book()
.select(self.family.as_str(), variant(styles))
- .and_then(|id| world.font(id).ok())
+ .and_then(|id| world.font(id))
.ok_or("failed to find math font")
.at(span)?;