1 | <?php |
||
10 | final class AssetPublicationFailed extends PublicationFailed |
||
11 | { |
||
12 | private const CODE = 8002; |
||
13 | |||
14 | /** |
||
15 | * @var null|string |
||
16 | */ |
||
17 | protected ?string $assetType; |
||
|
|||
18 | |||
19 | /** |
||
20 | * AssetPublicationFailed constructor. |
||
21 | */ |
||
22 | public static function forProductAssetsOfType( |
||
23 | Product $product, |
||
24 | string $assetType, |
||
25 | Exception $previous = null |
||
26 | ): Exception { |
||
27 | $message = sprintf('Failed to publish %s assets for product `%s`.', $assetType, $product->getName()); |
||
28 | $self = new self($message, self::CODE, $previous); |
||
29 | $self->product = $product; |
||
30 | $self->assetType = $assetType; |
||
31 | |||
32 | return $self; |
||
33 | } |
||
34 | } |
||
35 |