handle() public method

public handle ( ) : integer | null
return integer | null
示例#1
0
 /**
  * {@inheritDoc}
  */
 public function handle()
 {
     $this->setPageTitle("concrete5 has encountered an issue.");
     $result = self::QUIT;
     $enabled = Config::get('concrete.debug.display_errors');
     if ($enabled) {
         $detail = Config::get('concrete.debug.detail', 'message');
         if ($detail === 'debug') {
             $this->addDetails();
             $result = parent::handle();
         } else {
             $e = $this->getInspector()->getException();
             Core::make('helper/concrete/ui')->renderError(t('An unexpected error occurred.'), h($e->getMessage()));
         }
     } else {
         Core::make('helper/concrete/ui')->renderError(t('An unexpected error occurred.'), t('An error occurred while processing this request.'));
     }
     if (Config::get('concrete.log.errors')) {
         try {
             $e = $this->getInspector()->getException();
             $db = Database::get();
             if ($db->isConnected()) {
                 $l = new Logger(LOG_TYPE_EXCEPTIONS);
                 $l->emergency(sprintf("Exception Occurred: %s:%d %s (%d)\n", $e->getFile(), $e->getLine(), $e->getMessage(), $e->getCode()), array($e));
             }
         } catch (\Exception $e) {
         }
     }
     return $result;
 }
示例#2
0
 public function handle(\Throwable $throwable)
 {
     // echo '1';
     $pretty = new PrettyPageHandler();
     $pretty->setException($throwable);
     $pretty->setInspector(new Inspector($throwable));
     $pretty->handle();
 }
示例#3
0
 /**
  * Add data to the page
  */
 public function handle()
 {
     $exception = $this->getException();
     //Catch the client exception
     if ($exception instanceof ClientException) {
         $error = ErrorResponse::model()->setAttributes(json_decode((string) $exception->getResponse()->getBody(), true));
         $this->addDataTable('API result', $error->getBody());
     }
     //Read from the api request log and show the data
     foreach (array_reverse(Api::getRequestLog(), true) as $key => $log) {
         $this->addDataTable("API Request #" . ($key + 1), $log->getBody());
     }
     //Add rate limits
     $this->addDataTable('Rate limits', ['limit' => App::getInstance()->getRateLimit()->limit, 'remaining' => App::getInstance()->getRateLimit()->remaining, 'reset' => App::getInstance()->getRateLimit()->getDateTime()]);
     $this->setPageTitle('Error ' . $this->getException()->getMessage());
     parent::handle();
 }
 /**
  * {@inheritDoc}
  */
 public function handle()
 {
     $this->setPageTitle("concrete5 has encountered an issue.");
     if (Config::get('concrete.log.errors')) {
         try {
             $e = $this->getInspector()->getException();
             $db = Database::get();
             if ($db->isConnected()) {
                 $l = new Logger(LOG_TYPE_EXCEPTIONS);
                 $l->emergency(t('Exception Occurred: ') . sprintf("%s:%d %s (%d)\n", $e->getFile(), $e->getLine(), $e->getMessage(), $e->getCode()), array($e));
             }
         } catch (Exception $e) {
         }
     }
     $debug = Config::get('concrete.debug.level', 0);
     if ($debug === DEBUG_DISPLAY_ERRORS) {
         $this->addDetails();
         return parent::handle();
     }
     Core::make('helper/concrete/ui')->renderError(t('An unexpected error occurred.'), t('An error occurred while processing this request.'));
     Core::shutdown();
 }
 /**
  * Calls the `::handle()` method on the parent.
  *
  * Enables testing of the parent call.
  * 
  * @return int|null
  *
  * @codeCoverageIgnore
  */
 protected function parentHandle()
 {
     return parent::handle();
 }