|
5 | 5 |
|
6 | 6 | use Assets\Error\FileNotFoundException; |
7 | 7 | use Assets\Error\FilterNotFoundException; |
| 8 | +use Assets\Error\ModificationFailedException; |
8 | 9 | use Assets\Error\UnkownErrorException; |
9 | 10 | use Assets\ImageCreation\FilterInterface; |
10 | 11 | use Assets\ImageCreation\ImageInterface; |
@@ -459,12 +460,35 @@ private function applyModifications(ImageInterface $image, ImageManagerInterface |
459 | 460 | ); |
460 | 461 | } |
461 | 462 |
|
462 | | - $image = $filterClassName::create($manager, ...$params)->applyFilter($image); |
| 463 | + try { |
| 464 | + $image = $filterClassName::create($manager, ...$params)->applyFilter($image); |
| 465 | + } catch (\Throwable $throwable) { |
| 466 | + throw new ModificationFailedException( |
| 467 | + sprintf( |
| 468 | + 'Unable to apply filter `%s` with params %s.', |
| 469 | + $filterClassName, |
| 470 | + var_export($params, true), |
| 471 | + ), |
| 472 | + previous: $throwable, |
| 473 | + ); |
| 474 | + } |
463 | 475 | continue; |
464 | 476 | } |
465 | 477 |
|
466 | 478 | $params = is_array($params) ? $params : [$params]; |
467 | | - $image->modify($method, $params); |
| 479 | + |
| 480 | + try { |
| 481 | + $image->modify($method, $params); |
| 482 | + } catch (\Throwable $throwable) { |
| 483 | + throw new ModificationFailedException( |
| 484 | + sprintf( |
| 485 | + 'Unable to modify image with method `%s` and params %s.', |
| 486 | + $method, |
| 487 | + var_export($params, true), |
| 488 | + ), |
| 489 | + previous: $throwable, |
| 490 | + ); |
| 491 | + } |
468 | 492 | } |
469 | 493 |
|
470 | 494 | return $image; |
|
0 commit comments