Closed yoannisj closed 2 years ago
Thanks for reporting. The issue actually was that suppressException was working, I just wasn't accounting for transformImage to return null
. 🤦♂️ If suppressException was set to false
, it would actually return null
if an exception occured. 🤪
Fixed for the next release.
Steps to reproduce
supressExceptions
config setting totrue
php craft clear-caches/all
(just to be sure)/admin/graphiql
and run the following query (assuming there is no named transform called'foo'
):Description
The plugin's `transformImage()` function can return `null` in multiple cases: - the transformed source image was not found - an Exception was thrown and the plugin's `suppressExceptions` setting is `true` - a plugin cancelled the transform via the `EVENT_BEFORE_TRANSFORM_IMAGE` event - the transformer's `transform()` method return `null` - ... However the `transformImage()` graphQL directive is currently [not handling](https://github.com/spacecatninja/craft-imager-x/blob/master/src/gql/directives/ImagerTransform.php#L92-L116) cases where `ImagerX::$plugin->imagerx->transformImage()` returns `null`, and throws an Error (see below). The directive should probably just return `null` in the GraphQL results if that's what it gets from the `transformUrl()` method. ### Displayed errors, stack trace, relevant logsAdditional info