Skip to content

Commit

Permalink
Merge pull request #139 from yoannisj/feature/error-logging
Browse files Browse the repository at this point in the history
log errors thrown in default action - Fixes #117
  • Loading branch information
brandonkelly committed May 26, 2021
2 parents f7996a7 + 3a530ad commit 2baf504
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/controllers/DefaultController.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,12 @@ 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);
}

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

0 comments on commit 2baf504

Please sign in to comment.