public static function uncaughtExceptionHandler(\Exception $e) { if (Daemon::$context !== null) { if (Daemon::$context->handleException($e)) { return; } } $msg = $e->getMessage(); Daemon::log('Uncaught ' . get_class($e) . ' (' . $e->getCode() . ')' . (mb_orig_strlen($msg) ? ': ' . $msg : '') . ".\n" . $e->getTraceAsString()); if (Daemon::$context instanceof \PHPDaemon\Request\Generic) { Daemon::$context->out('<b>Uncaught ' . get_class($e) . ' (' . $e->getCode() . ')</b>' . (mb_orig_strlen($msg) ? ': ' . $msg : '') . '.<br />'); } }
/** * Called when timer is triggered * @return void */ public function eventCall() { try { //Daemon::log('cb - '.Debug::zdump($this->cb)); call_user_func($this->cb, $this); } catch (\Exception $e) { Daemon::uncaughtExceptionHandler($e); } }