Skip to content

Commit 14f465f

Browse files
committed
Fixed #157
1 parent 5dc1496 commit 14f465f

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Release Notes for Element API
22

3+
## Unreleased
4+
5+
### Fixed
6+
- Fixed a bug where an invalid response code would be returned if the `one` endpoint config setting was used and Craft could not find a matching element. ([#157](https://github.com/craftcms/element-api/issues/157))
7+
38
## 2.8.3 - 2021-09-25
49

510
### Fixed

src/resources/ElementResource.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,6 @@ public function getResource(): ResourceInterface
118118
if ($this->one) {
119119
$element = $query->one();
120120

121-
if (!$element) {
122-
throw new Exception('No element exists that matches the endpoint criteria');
123-
}
124-
125121
$resource = new Item($element, $transformer, $this->resourceKey);
126122
} else if ($this->paginate) {
127123
// Create the paginator

0 commit comments

Comments
 (0)