/** * Parses a ServerQuery error and throws a TeamSpeak3_Adapter_ServerQuery_Exception object if * there's an error. * * @param string $err * @throws Exception * @return void */ protected function fetchError($err) { $cells = $err->section(\ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\TeamSpeak3::SEPARATOR_CELL, 1, 3); foreach ($cells->split(\ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\TeamSpeak3::SEPARATOR_CELL) as $pair) { list($ident, $value) = $pair->split(\ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\TeamSpeak3::SEPARATOR_PAIR); $this->err[$ident->toString()] = $value->isInt() ? $value->toInt() : $value->unescape(); } \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\Helper\Signal::getInstance()->emit("notifyError", $this); if ($this->getErrorProperty("id", 0x0) != 0x0) { if ($permid = $this->getErrorProperty("failed_permid")) { try { $suffix = " (failed on " . $this->con->permissionGetNameById($permid) . ")"; } catch (Exception $e) { $suffix = " (failed on " . $this->cmd->section(\ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\TeamSpeak3::SEPARATOR_CELL) . " " . $permid . "/0x" . strtoupper(dechex($permid)) . ")"; } } elseif ($details = $this->getErrorProperty("extra_msg")) { $suffix = " (" . $details . ")"; } else { $suffix = ""; } throw new Exception($this->getErrorProperty("msg") . $suffix, $this->getErrorProperty("id")); } }