Skip to content

Commit

Permalink
Fail silently on asset exceptions when processing data for fieldtype …
Browse files Browse the repository at this point in the history
…index (entry lists, tables) (#235)
  • Loading branch information
ncla authored Jul 23, 2023
1 parent 37ada24 commit 167d3c5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Fieldtypes/ResponsiveFieldtype.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
namespace Spatie\ResponsiveImages\Fieldtypes;

use Illuminate\Support\Arr as IlluminateArr;
use Spatie\ResponsiveImages\AssetNotFoundException;
use Spatie\ResponsiveImages\Breakpoint;
use Spatie\ResponsiveImages\Exceptions\InvalidAssetException;
use Spatie\ResponsiveImages\Fieldtypes\ResponsiveFields as ResponsiveFields;
use Spatie\ResponsiveImages\GraphQL\ResponsiveFieldType as GraphQLResponsiveFieldtype;
use Spatie\ResponsiveImages\Responsive;
Expand Down Expand Up @@ -148,7 +150,11 @@ public function preProcessIndex($data)
return [];
}

$responsive = new Responsive($data['src'], Parameters::make($data, Context::make()));
try {
$responsive = new Responsive($data['src'], Parameters::make($data, Context::make()));
} catch (AssetNotFoundException | InvalidAssetException) {
return [];
}

return $responsive->breakPoints()
->map(function (Breakpoint $breakpoint) {
Expand Down

0 comments on commit 167d3c5

Please sign in to comment.