Example #1
0
 /**
  * Handle an exception
  * @param CircuitException
  * @return void
  */
 public function handleException(Exception $e)
 {
     $this->exception = $e;
     if ($e instanceof CircuitRedirectException) {
         $this->getObserver()->set('redirect.path', $e->getURL());
         $this->getObserver()->set('redirect.message', $e->getMessage());
     }
     if (method_exists($e, 'getErrorCode')) {
         $this->getObserver()->set('error.code', $e->getErrorCode());
     }
     if (method_exists($e, 'getTitle')) {
         $this->getObserver()->set('error.title', $e->getTitle());
     }
     $this->getObserver()->set('error.message', $e->getMessage());
     $this->getObserver()->set('error.line', $e->getLine());
     $this->getObserver()->set('error.file', $e->getFile());
     $this->getObserver()->set('error.debug', method_exists($e, 'getDebug') ? $e->getDebug() : $e->getTraceAsString());
     $outcome = method_exists($e, 'getType') ? $e->getType() : VIEW_ERROR;
     foreach ($this->exception_listeners as $listener) {
         $obj = $listener[0];
         $method = $listener[1];
         try {
             $r = $obj->{$method}($e);
             if ($r instanceof CircuitActionCode) {
                 $outcome = $r->code;
             }
         } catch (Exception $v) {
         }
     }
     return $outcome;
 }