From 3e73149716b74a119c967e229a7dfb194ec87a0c Mon Sep 17 00:00:00 2001 From: whwyy Date: Wed, 13 Dec 2023 17:43:25 +0800 Subject: [PATCH] eee --- Command.php | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/Command.php b/Command.php index f5335c4..490b518 100644 --- a/Command.php +++ b/Command.php @@ -128,10 +128,12 @@ class Command extends Component return $result; } catch (Throwable $throwable) { - if ($this->isRefresh($throwable)) { - return $this->search($method); - } - return $this->getLogger()->failure(throwable($throwable), 'mysql'); + if ($this->isRefresh($throwable)) return $this->search($method); + + $logger = $this->getLogger(); + + $logger->error($this->sql . '.' . json_encode($this->params) . PHP_EOL . throwable($throwable)); + return $logger->failure($throwable->getMessage(), 'mysql'); } finally { $this->connection->release($client); } @@ -168,10 +170,12 @@ class Command extends Component return $result == 0 ? $prepare->rowCount() : (int)$result; } catch (Throwable $throwable) { - if ($this->isRefresh($throwable)) { - return $this->_prepare(); - } - return $this->getLogger()->failure(throwable($throwable), 'mysql'); + if ($this->isRefresh($throwable)) return $this->_prepare(); + + $logger = $this->getLogger(); + + $logger->error($this->sql . '.' . json_encode($this->params) . PHP_EOL . throwable($throwable)); + return $logger->failure($throwable->getMessage(), 'mysql'); } finally { $this->connection->release($client); }