Ejemplo n.º 1
0
 /**
  * @method errors
  * @static
  * @protected
  * @param {Exception} $exception
  * @param {string} $module
  * @param {string} [$partial_response=null]
  */
 protected static function errors($exception, $module, $partial_response = null)
 {
     self::$errors_occurred = true;
     $response_started = self::$response_started;
     $errors = Q_Response::getErrors();
     Q::$toolWasRendered = array();
     try {
         if (self::$handling_errors) {
             // We need to handle errors, but we
             // have already tried to do it.
             // Just show the errors view.
             Q::event('Q/errors/native', compact('errors', 'exception', 'partial_response', 'response_started'));
             return;
         }
         self::$handling_errors = true;
         if (Q::canHandle("{$module}/errors")) {
             /**
              * @event $module/errors
              * @param {Exception} exception
              * @param {string} module
              * @param {string} partial_response
              */
             Q::event("{$module}/errors", compact('errors', 'exception', 'partial_response', 'response_started'));
         } else {
             /**
              * @event Q/errors
              * @param {Exception} exception
              * @param {string} module
              * @param {string} partial_response
              */
             Q::event("Q/errors", compact('errors', 'exception', 'partial_response', 'response_started'));
         }
     } catch (Exception $e) {
         Q_Exception::rethrow($e, '');
         // may be for forwarding
         /**
          * @event Q/exception
          * @param {Exception} exception
          */
         Q::event('Q/exception', compact('exception'));
         // the original exception
     }
 }