Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/webchemistry/application-exception-handler
https://github.com/webchemistry/application-exception-handler
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/webchemistry/application-exception-handler
- Owner: WebChemistry
- Created: 2020-12-23T17:47:33.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2021-01-15T11:45:22.000Z (almost 4 years ago)
- Last Synced: 2024-04-24T17:39:57.797Z (8 months ago)
- Language: PHP
- Size: 2.93 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
## Application exception handler
```php
use Nette\Application\UI\Presenter;
use WebChemistry\ApplicationExceptionHandler\ApplicationExceptionHandler;
use WebChemistry\ApplicationExceptionHandler\ApplicationExceptionHandlerTrait;
use WebChemistry\ApplicationExceptionHandler\ApplicationExceptionRequest;abstract class BasePresenter extends Presenter {
use ApplicationExceptionHandlerTrait;
protected function initializeApplicationExceptionHandlers(ApplicationExceptionHandler $handler): void
{
$handler->addCatchException(
[UserNotLoggedInException::class],
function (ApplicationExceptionRequest $request): void {
$request->flashMessage('Musíte se nejprve přihlásit.', 'error');$request->redirect('@signIn', [
'backlink' => $request->link('this', ['backlink' => null]),
]);
}
);
}}
```