system.exception
return [
'hooks' => [
'system.exception' => function (Throwable $exception, bool $isLogged) {
// your code goes here
return $isLogged;
}
]
]
Parameters
| Parameter | Type |
|---|---|
| $exception | Throwable |
| $isLogged | bool |
When is the hook triggered
The hook is triggered for every exception and PHP error that reaches Kirby's error handler, whether debug mode is on or not. By default, Kirby writes the exception to the PHP error log afterwards.
Example
Return false to keep an exception out of the PHP error log, e.g. because you send it to an error tracking service instead:
<?php
return [
'hooks' => [
'system.exception' => function (Throwable $exception, bool $isLogged) {
// send the exception to your error tracking service
// …
// skip the PHP error log
return false;
}
]
];
Return $isLogged to keep the default.