Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

suppressExceptions config only suppressing ImagerException #299

Open
GaryReckard opened this issue Sep 16, 2020 · 0 comments
Open

suppressExceptions config only suppressing ImagerException #299

GaryReckard opened this issue Sep 16, 2020 · 0 comments

Comments

@GaryReckard
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant