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