Skip to content

Commit

Permalink
Cleanup + changeling for craftcms#118 + craftcms#139
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonkelly committed May 26, 2021
1 parent 6eabf5e commit 521bd26
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
### Changed
- Element API now requires Craft CMS 3.5 or later.
- Endpoint responses are now cached by default, and are invalidated automatically when relevant elements are saved or deleted.
- Exceptions thrown while resolving endpoints are now logged. ([#117](https://github.com/craftcms/element-api/issues/117))

### Fixed
- Fixed a bug where non-200 responses were getting cached. ([#130](https://github.com/craftcms/element-api/issues/130))
Expand Down
8 changes: 3 additions & 5 deletions src/controllers/DefaultController.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,9 @@ public function actionIndex(string $pattern): Response
$statusCode = $e instanceof HttpException ? $e->statusCode : 500;
$statusText = $e->getMessage();

// log error
Craft::error($e->getMessage(), __METHOD__);
/** @var \yii\base\ErrorHandler $errorHandler */
$errorHandler = $this->getErrorHandler();
$errorHandler->logException($e);
// Log the exception
Craft::error('Error resolving Element API endpoint: ' . $e->getMessage(), __METHOD__);
Craft::$app->getErrorHandler()->logException($e);
}

// Create a JSON response formatter with custom options
Expand Down

0 comments on commit 521bd26

Please sign in to comment.