webchemistry / application-exception-handler
Installs: 2 695
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 0
Requires
- php: >= 7.4
This package is auto-updated.
Last update: 2024-10-15 19:52:49 UTC
README
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]), ]); } ); } }