diff --git a/app/common/Implement/Log/Handler/MySQL.php b/app/common/Implement/Log/Handler/MySQL.php index 8d2bc1c..1a580f7 100644 --- a/app/common/Implement/Log/Handler/MySQL.php +++ b/app/common/Implement/Log/Handler/MySQL.php @@ -5,6 +5,7 @@ use Incoviba\Common\Define\Connection; use Monolog\Handler\AbstractProcessingHandler; use Monolog\Level; use Monolog\LogRecord; +use PDOException; use PDOStatement; class MySQL extends AbstractProcessingHandler @@ -69,13 +70,21 @@ QUERY; private function checkTableExists(): bool { $query = "SHOW TABLES LIKE 'monolog'"; - $result = $this->connection->query($query); + try { + $result = $this->connection->query($query); + } catch (PDOException) { + return false; + } return $result->rowCount() > 0; } private function checkTableDeprecatedExists(): bool { $query = "SHOW TABLES LIKE 'monolog_deprecated'"; - $result = $this->connection->query($query); + try { + $result = $this->connection->query($query); + } catch (PDOException) { + return false; + } return $result->rowCount() > 0; } private function createTable(): void