src/Vectorface/SnappyRouter/SnappyRouter.php
private function handleInvocationException($exception, $activeHandler, $isCli)
    {
        $this->logger->debug(sprintf(
            "SnappyRouter: caught exception while invoking handler: %s (%d)",
            $exception->getMessage(),
            $exception->getCode()
        ));

        // if we have a valid handler give it a chance to handle the error
        if (null !== $activeHandler) {
            $activeHandler->invokePluginsHook(
                'errorOccurred',
                array($activeHandler, $exception)
            );
            return $activeHandler->getEncoder()->encode(
                new Response($activeHandler->handleException($exception))
            );
        }

        // if not on the command line, set an HTTP response code
        if (!$isCli) {
            $responseCode = AbstractResponse::RESPONSE_SERVER_ERROR;
            if ($exception instanceof RouterExceptionInterface) {
                $responseCode = $exception->getAssociatedStatusCode();
            }
            \Vectorface\SnappyRouter\http_response_code($responseCode);
        }
        return $exception->getMessage();
    }
private function handleInvocationException($exception, $activeHandler, $isCli)
    {
        $this->logger->debug(sprintf(
            "SnappyRouter: caught exception while invoking handler: %s (%d)",
            $exception->getMessage(),
            $exception->getCode()
        ));

        // if we have a valid handler give it a chance to handle the error
        if (null !== $activeHandler) {
            $activeHandler->invokePluginsHook(
                'errorOccurred',
                array($activeHandler, $exception)
            );
            return $activeHandler->getEncoder()->encode(
                new Response($activeHandler->handleException($exception))
            );
        }

        // if not on the command line, set an HTTP response code
        if (!$isCli) {
            $responseCode = AbstractResponse::RESPONSE_SERVER_ERROR;
            if ($exception instanceof RouterExceptionInterface) {
                $responseCode = $exception->getAssociatedStatusCode();
            }
            \Vectorface\SnappyRouter\http_response_code($responseCode);
        }
        return $exception->getMessage();
    }
private function handleInvocationException ( $ exception , $ activeHandler , $ isCli ) { $ this -> logger -> debug ( sprintf ( "SnappyRouter: caught exception while invoking handler: %s (%d)" , $ exception -> getMessage ( ) , $ exception -> getCode ( ) ) ) ; // if we have a valid handler give it a chance to handle the error if ( null !== $ activeHandler ) { $ activeHandler -> invokePluginsHook ( 'errorOccurred' , array ( $ activeHandler , $ exception ) ) ; return $ activeHandler -> getEncoder ( ) -> encode ( new Response ( $ activeHandler -> handleException ( $ exception ) ) ) ; } // if not on the command line, set an HTTP response code if ( ! $ isCli ) { $ responseCode = AbstractResponse :: RESPONSE_SERVER_ERROR ; if ( $ exception instanceof RouterExceptionInterface ) { $ responseCode = $ exception -> getAssociatedStatusCode ( ) ; } \ Vectorface \ SnappyRouter \ http_response_code ( $ responseCode ) ; } return $ exception -> getMessage ( ) ; }
Attempts to mop up after an exception during handler invocation.

@param \Exception $exception The exception that occurred during invocation.
@param HandlerInterface $activeHandler The active handler, or null.
@param bool $isCli True for CLI handlers, false otherwise.
@return mixed Returns a handler-dependent response type, usually a string.
Attempts to mop up after an exception during handler invocation .