Skip to content

Conversation

@ascorbic
Copy link
Contributor

Changes

If Astro detects that sharp is not installed when trying to transform an image it will throw a MissingSharp error. However when this happens during a build, we currently catch it and instead throw a CouldNotTransformImage error, with a message suggesting the image is corrupt. The correct error is buried in the cause. This PR checks if the thrown error is an AstroError, and if so rethrows it rather than throwing a CouldNotTransformImage error. This means that the MissingSharp error is logged correctly.

Testing

Tested manually

Docs

@changeset-bot
Copy link

changeset-bot bot commented Mar 12, 2025

🦋 Changeset detected

Latest commit: 64bdda1

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Mar 12, 2025
@codspeed-hq
Copy link

codspeed-hq bot commented Mar 12, 2025

CodSpeed Performance Report

Merging #13407 will not alter performance

Comparing img-astroerror (64bdda1) with main (854b25e)

Summary

✅ 6 untouched benchmarks

@ascorbic ascorbic merged commit 0efdc22 into main Mar 12, 2025
16 checks passed
@ascorbic ascorbic deleted the img-astroerror branch March 12, 2025 16:45
@astrobot-houston astrobot-houston mentioned this pull request Mar 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg: astro Related to the core `astro` package (scope)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants