protected function checkDbError() { if (!empty($this->_instance->error)) { Logger::error('SQL Error (' . $this->_instance->errno . '): ' . $this->_instance->error); switch ($this->_instance->errno) { case 1062: throw new DuplicateException($this->_instance->error); default: throw new \Exception('SQL Error: ' . $this->_instance->error . ' Last Query:(' . $this->_last_query . ')'); } } if ($this->_instance->warning_count != 0) { $message = ''; if ($result = $this->_instance->query("SHOW WARNINGS")) { while ($row = $result->fetch_row()) { $message .= $row[0] . ' (' . $row[1] . '): ' . $row[2] . PHP_EOL; } $result->close(); } Logger::error('SQL Warning: ' . $message); throw new \Exception('SQL Warning: ' . $message . ' Last Query:(' . $this->_last_query . ')'); } return TRUE; }