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

Don't throw top-level exceptions #1267

Merged
merged 1 commit into from Feb 14, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions Imagine/Data/DataManager.php
Expand Up @@ -15,6 +15,7 @@
use Liip\ImagineBundle\Binary\Loader\LoaderInterface;
use Liip\ImagineBundle\Binary\MimeTypeGuesserInterface;
use Liip\ImagineBundle\Exception\InvalidArgumentException;
use Liip\ImagineBundle\Exception\LogicException;
use Liip\ImagineBundle\Imagine\Filter\FilterConfiguration;
use Liip\ImagineBundle\Model\Binary;
use Symfony\Component\HttpFoundation\File\MimeType\ExtensionGuesserInterface as DeprecatedExtensionGuesserInterface;
Expand Down Expand Up @@ -124,7 +125,7 @@ public function getLoader($filter)
* @param string $filter
* @param string $path
*
* @throws \LogicException
* @throws LogicException
*
* @return BinaryInterface
*/
Expand All @@ -145,11 +146,11 @@ public function find($filter, $path)
}

if (null === $binary->getMimeType()) {
throw new \LogicException(sprintf('The mime type of image %s was not guessed.', $path));
throw new LogicException(sprintf('The mime type of image %s was not guessed.', $path));
}

if (0 !== mb_strpos($binary->getMimeType(), 'image/')) {
throw new \LogicException(sprintf('The mime type of image %s must be image/xxx got %s.', $path, $binary->getMimeType()));
throw new LogicException(sprintf('The mime type of image %s must be image/xxx got %s.', $path, $binary->getMimeType()));
}

return $binary;
Expand Down