Example #1
0
 public function printStackTrace()
 {
     $exception = is_null($this->wrappedException) ? $this : $this->wrappedException;
     if (coreConfig::get('sf_debug')) {
         $response = coreContext::getInstance()->getResponse();
         $response->setStatusCode(404);
         return parent::printStackTrace();
     } else {
         // debug message
         //echo $exception->getMessage();
         coreContext::getInstance()->getController()->forward(coreConfig::get('error_404_module'), coreConfig::get('error_404_action'));
     }
 }
Example #2
0
 /**
  * This is called by the front web controller to dispatch the request.
  * 
  * @return 
  */
 public function dispatch()
 {
     /* testing without mod_rewrite! */
     //$request_uri = trim($this->context->getRequest()->getParameter('url', ''), '/');
     //DBG::printr($this->context->getRequest()->getParameterHolder()->getAll());
     try {
         $request_uri = $this->request->getPathInfo();
         // use routes to determine module, action and url parameters
         $sf_routing = $this->initializeSymfonyRouting();
         $params = $sf_routing->parse($request_uri);
         // adds request url parameters to request object!
         $this->request->getParameterHolder()->add($params);
         // determine our module and action
         $moduleName = $this->request->getParameter('module');
         $actionName = $this->request->getParameter('action');
         if (empty($moduleName) || empty($actionName)) {
             throw new coreError404Exception(sprintf('Empty module and/or action after parsing the URL "%s" (%s/%s).', $request->getPathInfo(), $moduleName, $actionName));
         }
         $this->forward($moduleName, $actionName);
     } catch (coreException $e) {
         $e->printStackTrace();
     } catch (Exception $e) {
         coreException::createFromException($e)->printStackTrace();
     }
 }
Example #3
0
 public function __destruct()
 {
     try {
         self::run();
     } catch (\Exception $e) {
         coreException::handler($e);
     }
 }
Example #4
0
 /**
  * Wraps an Exception.
  *
  * @param Exception An Exception instance
  *
  * @return coreException A coreException instance that wraps the given Exception object
  */
 public static function createFromException(Exception $e)
 {
     $exception = new coreException(sprintf('Wrapped %s: %s', get_class($e), $e->getMessage()));
     $exception->setWrappedException($e);
     return $exception;
 }