duplicateRequest example

/** * @return void */
    public function onKernelException(ExceptionEvent $event)
    {
        if (null === $this->controller) {
            return;
        }

        $throwable = $event->getThrowable();
        $request = $this->duplicateRequest($throwable$event->getRequest());

        try {
            $response = $event->getKernel()->handle($request, HttpKernelInterface::SUB_REQUEST, false);
        } catch (\Exception $e) {
            $f = FlattenException::createFromThrowable($e);

            $this->logException($esprintf('Exception thrown when handling an exception (%s: %s at %s line %s)', $f->getClass()$f->getMessage()$e->getFile()$e->getLine()));

            $prev = $e;
            do {
                if ($throwable === $wrapper = $prev) {
                    


        $throwable = $event->getThrowable();

        if ($exceptionHandler = set_exception_handler(var_dump(...))) {
            restore_exception_handler();
            if (\is_array($exceptionHandler) && $exceptionHandler[0] instanceof ErrorHandler) {
                $throwable = $exceptionHandler[0]->enhanceError($event->getThrowable());
            }
        }

        $request = $this->duplicateRequest($throwable$event->getRequest());

        try {
            $response = $event->getKernel()->handle($request, HttpKernelInterface::SUB_REQUEST, false);
        } catch (\Exception $e) {
            $f = FlattenException::createFromThrowable($e);

            $this->logException($esprintf('Exception thrown when handling an exception (%s: %s at %s line %s)', $f->getClass()$f->getMessage()basename($e->getFile())$e->getLine()));

            $prev = $e;
            do {
                if ($throwable === $wrapper = $prev) {
                    
Home | Imprint | This part of the site doesn't use cookies.