display404errors example

try {
            $this->response = $this->handleRequest($routesconfig(Cache::class)$returnResponse);
        } catch (ResponsableInterface|DeprecatedRedirectException $e) {
            $this->outputBufferingEnd();
            if ($e instanceof DeprecatedRedirectException) {
                $e = new RedirectException($e->getMessage()$e->getCode()$e);
            }

            $this->response = $e->getResponse();
        } catch (PageNotFoundException $e) {
            $this->response = $this->display404errors($e);
        } catch (Throwable $e) {
            $this->outputBufferingEnd();

            throw $e;
        }

        if ($returnResponse) {
            return $this->response;
        }

        $this->sendResponse();
    }
Home | Imprint | This part of the site doesn't use cookies.