Skip to content

suppressExceptions config only suppressing ImagerException #299

@GaryReckard

Description

@GaryReckard

If suppressExceptions is true, it will suppress the ImagerException here:

try {
if (!isset(self::$transformers[self::$transformConfig->transformer])) {
Craft::error('Invalid transformer "'.self::$transformConfig->transformer.'"', __METHOD__);
throw new ImagerException('Invalid transformer "'.self::$transformConfig->transformer.'"');
}
/** @var TransformerInterface $transformer */
$transformer = new self::$transformers[self::$transformConfig->transformer]();
$transformedImages = $transformer->transform($image, $transforms);
} catch (ImagerException $e) {
if (self::$transformConfig->suppressExceptions) {
return null;
}
throw $e;
}

However, my code is throwing an AssetException here, which is not getting caught here, and I cannot suppress it.

In my staging environment, my assets are not synced up with production, but I am using a production database copy... so sometime images do not exist. My twig templates are doing some really weird things, breaking when an image is not available and imager.transformImage is called. I need to be able to suppress these Exceptions.

This is related to this issue as well (#298), which is making setting suppressExceptions pointless in devMode.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions