расширил информацию ошибок базы

This commit is contained in:
rsgrinko committed 2022-07-22 17:30:20 +03:00
1 parent 85bea9433d
commit 6601901f01
3 files changed
+11 -4

No files matched your search

+3
View File
@@ -190,6 +190,9 @@
$itemId = $DB->addItem('jokes', ['hash' => $hash, 'text' => $joke]); $itemId = $DB->addItem('jokes', ['hash' => $hash, 'text' => $joke]);
} }
} }
if($i < 1 ) {
throw new CoreException('Новых шуток не найдено');
}
return 'Добавлено ' . $i . ' шуток из ' . count($arJokes); return 'Добавлено ' . $i . ' шуток из ' . count($arJokes);
} }
+5 -2
View File
@@ -213,9 +213,12 @@
try { try {
$stmt = $this->db->query($sql); $stmt = $this->db->query($sql);
} catch (\Throwable $t) { } catch (\Throwable $t) {
sendTelegram('SQL ERROR: ' . $sql); sendTelegram(
'<b><u>' . date('d.m.Y H:i:s') . '</u></b>' . PHP_EOL . '</b><b>SQL ERROR:</b> ' . PHP_EOL . $this->db->errorInfo()[2] . PHP_EOL
. '<b>QUERY:</b> ' . PHP_EOL . $sql
);
if(DEBUG) { if(DEBUG) {
throw new CoreException('В SQL запросе произошла ошибка. Запрос: ' . $sql, CoreException::ERROR_SQL_QUERY); throw new CoreException('В SQL запросе произошла ошибка. '.$this->db->errorInfo()[2].' Запрос: ' . $sql, CoreException::ERROR_SQL_QUERY);
} else { } else {
throw new CoreException('В SQL запросе произошла ошибка', CoreException::ERROR_SQL_QUERY); throw new CoreException('В SQL запросе произошла ошибка', CoreException::ERROR_SQL_QUERY);
} }
+3 -2
View File
@@ -355,7 +355,7 @@
// Добор заданий // Добор заданий
$this->setTasksActiveStatus(); $this->setTasksActiveStatus();
if ($this->hasMaxWorkers()) { if ($this->hasMaxWorkers() && !$childProcess) {
if (USE_LOG) { if (USE_LOG) {
Log::logToFile( Log::logToFile(
'Достигнуто максимальное количество воркеров. Работает ' . $this->getCountWorkers() . '/' . self::WORKERS_LIMIT, 'Достигнуто максимальное количество воркеров. Работает ' . $this->getCountWorkers() . '/' . self::WORKERS_LIMIT,
@@ -438,7 +438,8 @@
public function flush(): void public function flush(): void
{ {
$this->stopAllWorkers(); $this->stopAllWorkers();
$this->DB->query('TRUNCATE ' . self::TABLE . '; TRUNCATE ' . self::TABLE_HISTORY . ';'); $this->DB->query('TRUNCATE ' . self::TABLE . ';');
$this->DB->query('TRUNCATE ' . self::TABLE_HISTORY . ';');
} }
/** /**
* Массовое создание заданий * Массовое создание заданий