Rails 7: PreviewError now raised in ActiveStorage

When ActiveStorage handles media uploads, the Poppler gem takes care of preview generation to be used all across the application. In previous versions of Rails, a failure in creating a preview would capture a 0-byte IO stream and send that to ActiveStorage. For instance, if a user uploaded a media file and the preview failed to generate, a 0-byte preview would still be stored and rendered, causing unexpected errors in the application.

Rails 7 raises a PreviewError when a previewer process exits with a non-0 status code.

Check the commit to know more about it.