diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-03-15 11:30:13 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-03-15 11:30:13 +0100 |
| commit | ae0a56cdffa515ed6bb7cb566c025cc66ff00f33 (patch) | |
| tree | 586f4b12af74c7fc29e34960bab004b39425195c /src/library/graphics/image.rs | |
| parent | 6f5b721fe56fe6e3735d03b07e3716fc39572639 (diff) | |
Non-returning error macro
Diffstat (limited to 'src/library/graphics/image.rs')
| -rw-r--r-- | src/library/graphics/image.rs | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/library/graphics/image.rs b/src/library/graphics/image.rs index 54793754..d11de9d1 100644 --- a/src/library/graphics/image.rs +++ b/src/library/graphics/image.rs @@ -1,4 +1,3 @@ -use crate::diag::Error; use crate::image::ImageId; use crate::library::prelude::*; use crate::library::text::TextNode; @@ -15,11 +14,9 @@ impl ImageNode { fn construct(ctx: &mut Context, args: &mut Args) -> TypResult<Content> { let path = args.expect::<Spanned<EcoString>>("path to image file")?; let full = ctx.resolve(&path.v); - let id = ctx.images.load(&full).map_err(|err| { - Error::boxed(path.span, match err.kind() { - std::io::ErrorKind::NotFound => "file not found".into(), - _ => format!("failed to load image ({})", err), - }) + let id = ctx.images.load(&full).map_err(|err| match err.kind() { + std::io::ErrorKind::NotFound => error!(path.span, "file not found"), + _ => error!(path.span, "failed to load image ({})", err), })?; let width = args.named("width")?; |
