Skip to content

Commit 05156f2

Browse files
[5.x] Improve error handling in entries fieldtype (#11754)
1 parent c6fceb4 commit 05156f2

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/Fieldtypes/Entries.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,11 @@ protected function getFirstCollectionFromRequest($request)
179179
$collections = $this->getConfiguredCollections();
180180
}
181181

182-
return Collection::findByHandle(Arr::first($collections));
182+
$collection = Collection::findByHandle($collectionHandle = Arr::first($collections));
183+
184+
throw_if(! $collection, new CollectionNotFoundException($collectionHandle));
185+
186+
return $collection;
183187
}
184188

185189
public function getSortColumn($request)

0 commit comments

Comments
 (0)