craftcms / element-api

Create a JSON API/Feed for your elements in Craft.
MIT License
498 stars 56 forks source link

Optionally ignore exceptions for queries that return empty #118

Closed chasegiunta closed 2 years ago

chasegiunta commented 4 years ago

Sometimes, especially on requests using search queries, we don't want exceptions to be thrown when the query returns empty. Could we have an option to not throw these?

brandonkelly commented 2 years ago

The only time I’m seeing an error returned for an entry result are when one is used. You can avoid that by not including 'one' => truein your endpoint config, and instead setting 'limit' => 1 in your criteria.