Example #1
0
 /**
  * throws exception and sends exception to xapp error logging chain
  *
  * @error 14310
  * @throws Xapp_Rpc_Fault
  */
 public function execute()
 {
     xapp_error($this, $this->getCode(), $this->getSeverity());
     throw $this;
 }
Example #2
0
 /**
  * error exception class constructor directs instance
  * to error xapp error handling
  *
  * @param string $message excepts error message
  * @param int $code expects error code
  * @param int $severity expects severity flag
  */
 public function __construct($message, $code = 0, $severity = XAPP_ERROR_ERROR)
 {
     parent::__construct($message, $code, $severity);
     xapp_error($this);
 }
Example #3
0
 /**
  * xapp default exception handler if xapp base class is used. bounces back error to generic
  * xapp_error function to be redirected to Xapp_Error for stacking, clear all handlers and by firing
  * trigger error without registered error/exception handlers force php to display error
  *
  * @static
  * @error 10512
  * @param Exception $e
  * @return bool false
  */
 public static function exceptionHandler(Exception $e = null)
 {
     if ($e !== null) {
         if ((int) ini_get('display_errors') === 0) {
             xapp_error($e, -1, XAPP_ERROR_ALERT);
         }
         restore_exception_handler();
         set_exception_handler(null);
         restore_error_handler();
         //trigger error will stop php immediately so all class destructors will not be called anymore
         //hence no error logging of not called exceptions therefore - log errors if display errors is
         //turned off if not throw fatal error
         if (ini_get('display_errors') === 0) {
             $type = E_USER_NOTICE;
         } else {
             $type = E_USER_ERROR;
         }
         if ($e->getCode() !== 0) {
             trigger_error($e->getCode() . ' : ' . $e->getMessage() . ', in: ' . $e->getFile() . ':' . $e->getLine() . '...', $type);
         } else {
             trigger_error($e->getMessage() . ', in: ' . $e->getFile() . ':' . $e->getLine() . '...', $type);
         }
     }
     return false;
 }