protected function handleException(Exception $e)
    {
        // if ($e instanceof MethodNotAllowedException) {
        //     $handler = 'notAllowedHandler';
        //     $params = [$e->getRequest(), $e->getResponse(), $e->getAllowedMethods()];
        // } elseif ($e instanceof NotFoundException) {
        //     $handler = 'notFoundHandler';
        //     $params = [$e->getRequest(), $e->getResponse(), $e];
        // } elseif ($e instanceof SlimException) {
        //     // This is a Stop exception and contains the response
        //     return $e->getResponse();
        // } else {
            // Other exception, use $request and $response params
            $handler = 'errorHandler';
            $params = [$e];
        // }

        if ($this->getContainer()->has($handler)) {
            $callable = $this->getContainer()->get($handler);
            // Call the registered handler
            return call_user_func_array($callable, $params);
        }

        // No handlers found, so just display simple error
        $this->displayError($e->getMessage());
        exit($e->getCode() ?: 1);
    }
protected function handleException(Exception $e)
    {
        // if ($e instanceof MethodNotAllowedException) {
        //     $handler = 'notAllowedHandler';
        //     $params = [$e->getRequest(), $e->getResponse(), $e->getAllowedMethods()];
        // } elseif ($e instanceof NotFoundException) {
        //     $handler = 'notFoundHandler';
        //     $params = [$e->getRequest(), $e->getResponse(), $e];
        // } elseif ($e instanceof SlimException) {
        //     // This is a Stop exception and contains the response
        //     return $e->getResponse();
        // } else {
            // Other exception, use $request and $response params
            $handler = 'errorHandler';
            $params = [$e];
        // }

        if ($this->getContainer()->has($handler)) {
            $callable = $this->getContainer()->get($handler);
            // Call the registered handler
            return call_user_func_array($callable, $params);
        }

        // No handlers found, so just display simple error
        $this->displayError($e->getMessage());
        exit($e->getCode() ?: 1);
    }
protected function handleException ( Exception $ e ) { // if ($e instanceof MethodNotAllowedException) { //     $handler = 'notAllowedHandler'; //     $params = [$e->getRequest(), $e->getResponse(), $e->getAllowedMethods()]; // } elseif ($e instanceof NotFoundException) { //     $handler = 'notFoundHandler'; //     $params = [$e->getRequest(), $e->getResponse(), $e]; // } elseif ($e instanceof SlimException) { //     // This is a Stop exception and contains the response //     return $e->getResponse(); // } else { // Other exception, use $request and $response params $ handler = 'errorHandler' ; $ params = [ $ e ] ; // } if ( $ this -> getContainer ( ) -> has ( $ handler ) ) { $ callable = $ this -> getContainer ( ) -> get ( $ handler ) ; // Call the registered handler return call_user_func_array ( $ callable , $ params ) ; } // No handlers found, so just display simple error $ this -> displayError ( $ e -> getMessage ( ) ) ; exit ( $ e -> getCode ( ) ? : 1 ) ; }
Call relevant handler from the Container if needed. If it doesn't exist,
then just print error

@param  Exception $e

@return Context
Call relevant handler from the Container if needed . If it doesn t exist then just print error